Welcome Guest, Not a member yet? Register   Sign In
CI 1.7: mysqli error when using empty port
#1

[eluser]sinzy[/eluser]
Hi, there, just upgraded to CI 1.7, however my app reports "Unable to connect to your database server using the provided settings."

After some investigation, I think it is because of the new "port" support for mysql/mysqli. (My app uses mysqli).

By default, in DB_driver.php, $port = ''. And in mysqli_driver.php, the db_connect() function just use this empty port, so there is an error. If I remove the $this->port in this function, my app works again.

But in mysql_driver.php there is a check for port, so no problem.

It is a bug I think. Smile
#2

[eluser]thespy[/eluser]
same problem here after updating from 1.6.3 to 1.7 :

ERROR - 2008-10-24 16:20:37 --> Severity: Warning --> mysqli_connect() expects parameter 5 to be long, string given /home/site.com/codeigniter_system/database/drivers/mysqli/mysqli_driver.php 63
ERROR - 2008-10-24 16:20:37 --> Unable to connect to the database

And problem fixed with remove the "port" parameter in mysqli_driver.php
#3

[eluser]narkaT[/eluser]
a fix that not requires hacking the core files:

in APP/config/database.php add the following line
Code:
$db['default']['port'] = "3306";

if you renamed the database group remember to change 'default' to what ever you named it Wink
#4

[eluser]Derek Jones[/eluser]
Thanks, fixed in the SVN. How rude of PHP to try to use an empty string as a long integer.
#5

[eluser]Ricardo Rodrigues[/eluser]
Worked! Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB