PHP 5.6 with Mysqli_connect

We recently updated PHP to the latest version and we had a php script running which was now broken.

Currently it doesn't even allow me to connect to the SQL database at all and returns this error: "Failed to connect to MySQL: Can't connect to MySQL server on mysql01.fau.edu (13) 2003".

The database itself is in a linux environment and currently I can't get even a simple script like the one below:

$host = 'mysql01.fau.edu';
$username = '*****';
$password = '*****';
$database = '******';
$connect = mysqli_connect($host,$username,$password,$database);

if (mysqli_connect_errno()) {
    echo 'Failed to connect to MySQL: ' . mysqli_connect_error() . mysqli_connect_errno();
} else {
    echo 'Connected to MySQL! </ br>';
}

      

Any help would be greatly appreciated. Thank!

+4


source to share


3 answers


Just guess ... but make sure you can connect to mysql from the command line. If so ... double check your php.ini. It looks like php.ini might be overwritten by an update. Make sure extensions for mysql are enabled.



0


source


For security reasons, Mysql is not available for remote access by default, unless you have specified a resolved IP address in the backend.

You mentioned that it was used to run on your laptop, which can change the IP a lot.



Use the same network when it was working

0


source


mysqli connect stops working from version 5.5 upwards starting from php 7 updwards it was removed and will give you http ERROR 500 referring to link below

"Call undefined function mysql_connect ()" after upgrading to php-7

0


source







All Articles