PDO Connection Error

Status
Not open for further replies.

phoenixreviews

New Member
Messages
34
Reaction score
0
Points
0
My site has recently stopped working, due to database connection errors. I haven't update any code on the site, but now PHP is showing me the following error:

[29-Sep-2010 22:46:06] PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

This is repeated every time I try to visit a page which requires database access.
I can access the database fine with phpMyAdmin, and CPanel and Account Control Panel both work correctly.

Is there anything I can do to fix this? Any possible cause? As I said, no changes have been made to the code recently, so it's not a simple connection fault.

Site: phoenixreviews.info
Server: starka

Update: The exact page that is failing: http://phoenixreviews.info/review/list
Both this, and the author list page, are showing "500 Internal Server Error".
 
Last edited:

phoenixreviews

New Member
Messages
34
Reaction score
0
Points
0
Well, for the moment I seem to have found a workaround. I'm running the Symfony framework, and changed my databases.yml DSN to read as follows (new section in bold):

dsn: 'mysql:host=localhost;dbname=my_db_name;unix_socket:/var/lib/mysql/mysql.sock'

When I remove the unix_socket section, it just shows 500 internal server error again. I'm not sure why adding that section fixes the problem - I'm just manually specifying the same socket the server was using before. There still seems to be a bug with the x10 hosting that disallows connecting to the database with default PHP settings. Could be something to do with the socket setting in my.cnf, or a recent MySQL upgrade perhaps?
 
Status
Not open for further replies.
Top