Problems with mysql5+php4 not recognizing mysql.default_socket

Chris Waltham CWaltham at Pressherald.com
Thu Sep 7 06:02:34 PDT 2006


I've installed cacti from the DarwinPorts collection, but am having  
some trouble getting it to run correctly. Specifically, cacti is  
looking in the wrong place for the MySQL socket to connect to. I  
believe that I've followed the instructions, and added this line to  
my /opt/local/etc/php.ini:

mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock

I can confirm that the file exists and is readable:

srwxrwxrwx   1 mysql  admin  0 Sep  6 16:29 /opt/local/var/run/mysql5/ 
mysqld.sock

Curiously, the problem seems to originate in that either PHP or  
Apache (I'm using the Personal Web Sharing server that's bundled with  
10.4.7) is refusing to honor the line I've specified in the php.ini  
file. I created a simple test page with a phpinfo() call, and I get  
this result in the diagnosis:

Active Persistent Links
0
Active Links
0
Client API version
4.1.13a
MYSQL_MODULE_TYPE
external
MYSQL_SOCKET
/var/mysql/mysql.sock
MYSQL_INCLUDE
-I/usr/include/mysql
MYSQL_LIBS
-L/usr/lib/mysql -lmysqlclient

So, you can see that the MYSQL_SOCKET variable doesn't reflect what's  
specified in my php.ini file. FWIW, I copied the php.ini-dist file  
that came with the php4 distribution into a new file named php.ini  
and added the required line for the default_socket parameter.

When I access cacti, this is the error that I get:

Warning: mysql_pconnect(): Can't connect to local MySQL server  
through socket '/var/mysql/mysql.sock' (2) in /opt/local/share/cacti/ 
lib/adodb/drivers/adodb-mysql.inc.php on line 355

I'm sure that it relates to the fact that php itself doesn't know  
that the MySQL socket actually lives in /opt/local/var/run/mysql5,  
instead of /var/mysql. The question is, how do I get php to see the  
file as it's supposed to? The client is a G4 PowerMac running 10.4.7  
Client.

Thanks!


Chris




More information about the macports-users mailing list