Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Database error after upgrade from PHP5.3 to PHP5.4
#1

[eluser]skunkbad[/eluser]
Turns out that the testing server does not know how to resolve "localhost" or "127.0.0.1". I had to use a specific IP to access MySQL. Everything else seems fine, as it should.

-- ORIGINAL POST BELOW --

I have a need to upgrade one of my old applications to PHP5.4. When I do I get these errors:

Code:
PHP E_WARNING #2 - Date/Time: 11/6/2013 12:01:35
File: /home/www/example.com/system/database/drivers/mysqli/mysqli_driver.php
Line: 76
mysqli_connect(): (HY000/2002): No such file or directory

and

Code:
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346

I tried searching the forum a bit, but didn't see anything, and since I don't come here anymore, I have no idea if this has been asked in the past. Anyone know what's up?

Actually, what's kind of weird is that the dev server is on 5.4.4 and no issues...
#2

[eluser]CroNiX[/eluser]
Heya Stranger Smile do a phpinfo() and make sure the mysqli extension is installed.
#3

[eluser]skunkbad[/eluser]
[quote author="CroNiX" date="1383785559"]Heya Stranger Smile do a phpinfo() and make sure the mysqli extension is installed.[/quote]

Yeah, it was really just the hostname resolution. I've worked on servers where there needed to be a special hostname for MySQL, but in this case PHP5.3 worked with "localhost", and PHP5.4 didn't. I had to go in and specify the IP of the database server, and then it worked. This was a little tricky to debug, because like you suggested, the first thing I checked was that MySQLi was available, but it was. I then wondered if it was something internal to CI, but the dev server is PHP5.4, so it didn't make sense. Until I searched Google for the specific error codes, I wasn't able to determine the reason why there was no DB connection, and fortunately somebody else had the problem with the hostname resolution.

Now I don't believe that PHP5.4 is more stupid than PHP5.3, so I think this is probably an issue where the host did not properly configure internal routing or DNS.

CroNiX, I kinda miss coming around. I never did really make a switch to another framework, but instead started building my own framework based on CI. More or less got it how I want it, and have started in on documenting it. I haven't used it for any production work yet. I'd show you what I've got if you want to see it. PM me your email address if you do.




Theme © iAndrew 2016 - Forum software by © MyBB