FS#17930 - [php] mysql socket must be explicitly provided in php.ini after update

Attached to Project: Arch Linux
Opened by Mårten Olsson (maos) - Wednesday, 20 January 2010, 21:04 GMT
Last edited by Pierre Schmitz (Pierre) - Wednesday, 03 February 2010, 23:54 GMT
Task Type Bug Report
Category Packages: Testing
Status Closed
Assigned To Pierre Schmitz (Pierre)
Andrea Scarpino (BaSh)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
After upgrading to php-5.3.1-4 and php-apache-5.3.1-4 I must explicitly provide the local socket in php.ini to be able to use mysql from php in apache.

Must add these in php.ini:
mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock

Example:
without having local socket in php.ini then phpmyadmin gives error "#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) "

Adding the two lines above or downgrading to php-5.3.1-3 and php-apache-5.3.1-3 makes it work again

Additional info:
* package version(s)
php-5.3.1-4/php-apache-5.3.1-4
* config and/or log files etc.
Adding the two lines above to php.ini solves it

Steps to reproduce:
1. make sure that nothing is set in mysql.default_socket and mysqli.default_socket and php-5.3.1-3 and php-apache-5.3.1-3
2 verify that php can use mysql
3. upgrade to php-5.3.1-4 and php-apache-5.3.1-4
4. restart apache
5. .... php access to mysql doesn't work
6. add mysql.default_socket = /var/run/mysqld/mysqld.sock and mysqli.default_socket = /var/run/mysqld/mysqld.sock at appropriate lines
7. restart apache again
8. and access to mysql works again
This task depends upon

Closed by  Pierre Schmitz (Pierre)
Wednesday, 03 February 2010, 23:54 GMT
Reason for closing:  Fixed
Comment by Pierre Schmitz (Pierre) - Wednesday, 20 January 2010, 21:16 GMT
Make sure you update your php.ini and my.cnf. This issue does not exist in a default installation of php and mysql.
Comment by Mårten Olsson (maos) - Friday, 22 January 2010, 18:59 GMT
extracting mysql-5.1.42-1-x86_64.pkg.tar.gz to /tmp and doing a diff to my my.cnf shows that only the datadir differs...
In my.cnf the socket is set to /var/run/mysqld/mysqld.sock both in client and server section

So I don't understand what is wrong.
Comment by Mårten Olsson (maos) - Friday, 22 January 2010, 19:00 GMT
Byt if noone else sees this problem it can be closed as it works with this change to config
Comment by Evangelos Foutras (foutrelis) - Monday, 01 February 2010, 12:09 GMT
  • Field changed: Percent Complete (100% → 0%)
I also came across this issue today. I don't think this is a configuration problem because 5.3.1-3 worked fine, and a bumped 5.3.2RC1 with the mysqlnd patch removed also works as expected.
Comment by Alexsandr Pavlov (kidoz) - Monday, 01 February 2010, 14:47 GMT
The same problem after upgrading to php 5.3.1-4-x86_64.
PHP Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock)
Added in php.ini:
mysql.default_socket = /var/run/mysqld/mysqld.sock
- works.

Comment by Andrea Scarpino (BaSh) - Monday, 01 February 2010, 19:24 GMT
packages work with a fresh install
Comment by Evangelos Foutras (foutrelis) - Monday, 01 February 2010, 20:24 GMT
Sorry, but I cannot confirm that it works. Even with a clean installation of mysql and php on a newly created VM, it appears to be looking for the socket in /tmp.

See my attempts with the mysql and pdo_mysql extensions at http://omploader.org/vM2YzMA

I've rebuilt php 5.3.1-4 with revision 60021 ("use upstream patch") [1] reverted and it now works on two machines that the official package didn't. I'm not able to pinpoint the reason why the upstream patch wouldn't work, but since php 5.3.2 (I tested RC1) will have this fixed reverting to "our" mysqlnd.patch might be a good solution.

----
[1] http://repos.archlinux.org/wsvn/packages/php/trunk/?op=revision&rev=60021
Comment by Linmiao Xu (lmx) - Tuesday, 02 February 2010, 14:30 GMT
I got the same error after upgrading to 5.3.1-4-i686 from 5.3.1-3-i686.

Adding "mysql.default_socket = /var/run/mysqld/mysqld.sock" to php.ini solves the problem.

Loading...