chrooting apache troubles mysql

Protecting your Linux box
Post Reply
ghulam yaseen
Naik
Posts: 68
Joined: Thu Aug 07, 2008 6:09 pm
Location: karachi

chrooting apache troubles mysql

Post by ghulam yaseen »

Hello All,

I have successfully implemeted the chroot enviorment for the Apache, the webpages work fine without involving mysql. But when i run a mysql related webpage it gives me error

Not connected to MySql...Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Any fix for this issue?
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

think about what "chroot" means. if apache is chrooted to /www (for example), the scripts will try to connect to /www/var/lib/mysql/mysql.sock. to the scripts, it will be /var/lib/mysql/mysql.sock.

configure mysql to use the new location for its socket, or configure your scripts (in php.ini, perhaps) to use tcp for db connections.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
ghulam yaseen
Naik
Posts: 68
Joined: Thu Aug 07, 2008 6:09 pm
Location: karachi

Post by ghulam yaseen »

thanks lambda, php.ini is a good option for apache security
Post Reply