0

I am reading the values from a text file that hold the connect parameters to connect to Mysql Server.

The content of the file is: localhost user password databaseName

I read the file and put the file and out the values into an array.

I then try to connect to the database using the following:

 $connParams = $this->databaseConfigArray;
 $connection = mysqli_connect($connParams[0], $connParams[1], $connParams[2], $connParams[3]);

This connection always fails. I debug and see that the strings in the array are correct and I can hard code the values and everything works fine.

Can someone tell me why the Array values don't work?

Thanks in advance

DSly
  • 26
  • 3
  • Are the parameters in the right order? – John Conde Nov 12 '13 at 19:55
  • So what does the error reporting of the mysqli extension say? At least take a look into the error log file of the http server instead of _guessing_ what might be the problem. That is what log files are there for: to tell you what the problem is! – arkascha Nov 12 '13 at 19:56
  • The error that is displayed is: Warning: mysqli_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: No such host is known. Even when I change to 127.0.0.1 I still get the same error. I am running PHP 5.5 on a Windows 7 machine using IIS 7 – DSly Nov 12 '13 at 21:45
  • Provide `var_dump($connParams)` – sectus Nov 13 '13 at 00:15

0 Answers0