For Programmers: Free Programming Magazines  


Home > Archive > PHP Installation > November 2006 > fcgi pdo_mysql connect problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author fcgi pdo_mysql connect problem
Antti Holvikari

2006-11-01, 6:57 pm

Hi!

I installed lighttpd, fastcgi and php 5.2RC6. I can't get the fastcgi
php to connect to mysql with pdo. If I run

php -r "new PDO('mysql:unix_socket=/opt/local/var/run/mysql5/mysqld.sock;dbname=dbname',
'root', '');"

...it works. But when I try to connect to mysql with fcgi (hitting my
script with browser) I get a:

Fatal error: Uncaught exception 'PDOException' with message
'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through
socket '/opt/local/var/run/mysql5/mysqld.sock' (13)'

I can also connect with:

> mysql5 --socket=/opt/local/var/run/mysql5/mysqld.sock -u root


....from the command line.

I'm pulling my hear with this. Do you have any clues what could be wrong?


--
Antti Holvikari <http://phphalo.com>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com