HTTP Error 500

Website URL: ea2914snkla.infinityfreeapp.com/project2website/login.php

Error Message:

" Fatal error : Uncaught Error: Call to undefined function mysql_connect() in /home/vol13_2/infinityfree.com/if0_38722082/htdocs/project2website/login.php:6 Stack trace: #0 {main} thrown in /home/vol13_2/infinityfree.com/if0_38722082/htdocs/project2website/login.php on line 6 "

Above error messages hows when I add this to my login.php file in Visual Studio Code: ini_set(‘display_errors’,1);
error_reporting(E_ALL);

mysql_connect(“localhost”,“root”,“”)or die(mysql_error(‘cannot connect’));
mysql_select_db(“matrimony”);

#OR

this message when I don’t have that in my PHP file:

"This page isn’t working right now

ea2914snkla.infinityfreeapp.com can’t currently handle this request.

HTTP ERROR 500"

Other Information

I am a complete newbie when it comes to PHP and systems, so if anyone can help guide me in the most simple terms/processes to get this to load, I will be forever grateful!!

Hello, Please read and follow these two articles:

7 Likes

Especially this

Using localhost is definitely wrong

5 Likes

This was just a suggested code to get more details on what was causing the error, and was what provided the more detailed error code about the ‘fatal error’. When I remove it, the error message is the HTTP Error 500.

The problem is that you’re using mysql_* style functions. These are the “old fashioned” way to connect to MySQL, which were removed from PHP starting PHP 7, which was released almost 10 years ago. In other words: this code won’t won’t work on any remotely modern system.

Is this your code? If so, please consider updating it to use the MySQLi or PDO functions instead (but I recommend MySQLi, it’s most similar). And please consider upgrading your development environment too, our hosting runs on PHP 8.2, and using the same or at least similar PHP versions will help to avoid incompatibilities like this.

If it’s not your code, then I recommend you replace this software with something more modern.

As a last resort, you should know that premium hosting come with the ability to select your PHP version, including PHP 5.x versions which still support this code. But making sure your code runs on modern PHP versions is still the smart thing to do long term.

6 Likes

Website URL

View All Songs

Error Message

Fatal error : Uncaught mysqli_sql_exception: No such file or directory in /home/vol13_2/infinityfree.com/if0_38722082/htdocs/project3website/mysqli_connect.php:5 Stack trace: #0 /home/vol13_2/infinityfree.com/if0_38722082/htdocs/project3website/mysqli_connect.php(5): mysqli_connect(‘localhost’, ‘root’, Object(SensitiveParameterValue), ‘topcountry’) #1 {main} thrown in /home/vol13_2/infinityfree.com/if0_38722082/htdocs/project3website/mysqli_connect.php on line 5

Other Information

This all works perfectly when I use my localhost but when I try to use Cyberduck to open through my infinityfree site, it gives me the above error.

Can infinityfree / my code pull the database directly from MyPHPAdmin account (root)?

Please read

This

is definitely wrong

5 Likes

Please do not open duplicate topics on the same issue. Please follow the advise that other users are giving you, creating a new post is not going to magically solve your issue

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.