Chroot and php.ini

yulia

Active Member
#1
Chrooting

I'm currently playing around with the chroot function, but can't seem to figure out how to load php.ini

I've tried lots of ways, none worked yet. Is there a trick? Current build:

Code:
./configure'  '--prefix=/opt/lsws/chroot/usr' '--with-litespeed' '--with-config-file-path=../php' ...
EDIT: Figured it out.
 
Last edited:

yulia

Active Member
#3
Well after some research I found you can change the MySQL sock to the tmp location in the chroot, but can't get MySQL to restart. Is it typically better to reinstall MySQL in the chroot?
 

mistwang

LiteSpeed Staff
#4
Changing the MYSQL socket location wont make MySQL to fail.
I think it is not a easy task to install MySQL in chroot, and it is not necessary.
 

yulia

Active Member
#5
is there a certain location i should change the MySQL sock to? I've been setting it in the tmp under the chroot, but MySQL like fails to start when i change it.
 

yulia

Active Member
#7
Code:
host:~# ls -la /opt/lsws/chroot/tmp
total 304
drwxrwxrwt  3 root  root    4096 Apr 22 12:44 .
drwxr-xr-x 11 root  root    4096 Apr 22 12:38 ..
drwx------  3 lsws  lsws    4096 Apr 22 12:50 lshttpd
srwxrwxrwx  1 mysql mysql      0 Apr 22 12:40 mysqld.sock
my.cnf
Code:
[client]
port            = 3306
#socket          = /var/run/mysqld/mysqld.sock
socket          = /opt/lsws/chroot/tmp/mysqld.sock
[mysqld]
port            = 3306
#socket          = /var/run/mysqld/mysqld.sock
socket          = /opt/lsws/chroot/tmp/mysqld.sock
(only error I can really find)
When attempting to log in via phpMyAdmin:
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
 
#8
You actually solved the problem in your first post. Think chroot. ;)

Basically, what we need to do is tell php how to connect to MySQL in the chroot.

Open your php.ini and scroll down looking for [MySQL] and set the following:
Code:
mysql.default_socket = /tmp/mysqld.sock
mysql.default_host = localhost
Should work just fine.
 
Last edited:

yulia

Active Member
#9
Thanks, worked.

On a side note, I guess if you compiled PHP after I changed the socked location then I would not need to make the php.ini edit?
 
Top