Jailkit is an easy to use tool to create and maintain jail environments for shell users on Linux. In this guide, I will show you how to move PHP and its dependencies into the jail so that the jailed user can execute PHP scripts inside the jail.
Edit the jailkit .ini file and add a section for PHP at the end of the file
Open the jk_init.ini file with an editor:
and paste the following lines at the end of the file:
[php] comment = the php interpreter and libraries executables = /usr/bin/php5 directories = /usr/lib/php5, /usr/share/php, /usr/share/php5, /etc/php5, /usr/share/php-geshi, [B]/usr/share/zoneinfo[/B] includesections = env [env] comment = environment variables executables = /usr/bin/env
Then run the command:
jk_init -c /etc/jailkit/jk_init.ini -f -k -j /var/www/clients/client1/web1 php
To install PHP and it's dependencies into the jail.
Add PHP for all newly jailed shell users
To add PHP for all newly jailed shell users that you add in ISPConfig, follow these steps:
- Login to ISPConfig and go to System > Server Config
- Select the server and go to the jailkit tab.
- Add the word "PHP" separated by a white space at the end of the "Jailkit chroot app sections" field and press save.