new php and mysql stop playing together

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

A bit of a newbie as far as mysql and php adminning I am; I upgraded
php to version 4.4.6, and mysql to 4.1.22, following the instructions
in the "INSTALL" files of each (I also have the same problem on
another server trying the latest mysql 5.0.*). After this, my php
won't connect to mysql, either with mysql_connect():

Warning: mysql_connect() [function.mysql-connect]: Can't connect to
local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) in /
var/www/html/test.php on line 4

or with ezMySQL:

 (Warning: Error establishing mySQL database connection. Correct user/
password? Correct hostname? Database server running? in /var/www/html/
lib/ez_sql_mysql.php on line 84)

I've checked, and /var/lib/mysql/mysql.sock is there, and I can
connect to the server with the "mysql" client program from the shell
just fine, with the same username, pass, server and database name as
I'm using in the code. And all non-database-related php code works
fine, so MySQL and PHP seem to be working OK independently of each
other; I suspect it's just a php setting somewhere. I'd like to get
more detailed information from the connection failure than the above
messages; is that possible? I set "LogLevel debug" in httpd.conf, and
"log-bin" in /etc/my.cnf, and these in /etc/php.ini:

error_reporting  =  E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
error_log = /var/log/php.log ;for some reason, it's not writing to

Here is the output of mysql_explain_log:

install_driver(mysql) failed: Can't locate DBD/ in @INC (@INC
contains: [....]) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: ExampleP, Proxy, Sponge.
 at bin/mysql_explain_log line 55

System info:
mysql  Ver 14.7 Distrib 4.1.22
PHP Version 4.4.6 (according to phpinfo(), but the "php" binary still
in my path is still 4.3.9)
php configure command:  ./configure --with-apxs2=/usr/sbin/apxs --with-
Apache: 2.0.52 (CentOS)
OS: CentOS release 4.4 (Final)

If phpinfo() output would help, let me know.



Re: new php and mysql stop playing together

drblitzkrieg wrote:

Quoted text here. Click to load it

Permissions on it?

Toby A Inkster BSc (Hons) ARCS
Contact Me ~
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Re: new php and mysql stop playing together

*** escribió/wrote (4 Apr 2007 01:43:08 -0700):
Quoted text here. Click to load it

Error nº 13 stands for "Permission denied".

Check the permissions of "/var/lib/mysql". In my system they look like

drwxr-xr-x   44 mysql    mysql        4096 abr  4 10:18 /var/lib/mysql/

Specifically, users not in mysql group should have "access" permission:

chmod o+x /var/lib/mysql/

I hope this helps.

-+ - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web:
+- Mi web de humor con rayos UVA:

Re: new php and mysql stop playing together

Yes, that helped. Though the socket perms were fine, the directory
drwx------  5 mysql root 1024 Apr  5 09:47 /var/lib/mysql/
I changed it to:
drwxr-xr-x  5 mysql mysql 1024 Apr  5 09:47 /var/lib/mysql/

For the record, after that it complained about "Client does not
support authentication protocol", but that was solved by resetting its
account's password with OLD_PASSWORD('pass'). Apparently php's mysql
client doesn't know about mysql's new password hashing even as late as
php 4.4.6!

Anyway, works now.


Quoted text here. Click to load it

Site Timeline