Background: Converted from EasyApache3 -> EasyApache4 (Cpanel). Went from mpm-prefork/php5.5/dso to mpm-worker/php71fpm/fastcgi.
The error message is:
Failed to parse address "127.0.0.1:3306:3306" in /home/user/conndb/conndb.php on line 2
The code is:
<?php
$con = mysqli_connect('127.0.0.1:3306','user','password','database');
?>
I had done a previous test of this configuration on a test server with no issues – so puzzled that I ran into this in production. Tried changing to localhost but no difference. Had to revert back to EasyApache3 config.
I’m stumped. Notice the port is repeated twice in the error message. I wonder if this version of mysqli is ‘smart’ enough to know to put in 3306 itself and then chokes when it’s explicitly coded?
2
Answers
Closing the question.... confirmed that removing the :3306 port corrected the issue. Obviously a change php5.5 to php7.1. I'm not sure how you'd deal with a non-standard mysql port - but not an issue for me.
According to PHP documentation if using non-standard port you must pass it as a fifth parameter –
And by “non-standard port” is meant everything, different by the result of
because this is the default value of this parameter.
The PHP documentation page – http://php.net/manual/en/mysqli.construct.php