• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Allow php5 json_decode function in a chrooted environment

Thomas_Lartaud

New Pleskian
Hi there,

I'm Running Plesk 12 latest version.

I've been partially followed that instructions to add php5 to a chrooted environment with success :
http://kb.odin.com/fr/115842
Code:
bash-4.3$ php --version
PHP 5.5.9-1ubuntu4.5 (cli) (built: Oct 29 2014 11:59:10)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies

This is how i did it, as root user :
Code:
./chroot_update.sh --add /usr/lib/php5

mkdir /var/www/vhosts/chroot/usr/share
cp -a /usr/share/zoneinfo /var/www/vhosts/chroot/usr/share

php -i | grep extension_dir
# returns : /usr/lib/php5/20121212/

for f in /usr/lib/php5/20121212/*.so ; do ./chroot_update.sh --add $f ; done

mkdir /var/www/vhosts/chroot/usr/lib/php5/20121212
cp -a /usr/lib/php5 /var/www/vhosts/chroot/usr/lib

mkdir /var/www/vhosts/chroot/usr/include
cp -a /usr/include/php5 /var/www/vhosts/chroot/usr/include

cd /var/www/vhosts/chroot/usr/lib/ && ln -s php5 php

This is a command that require the missing json module :
Code:
bash-4.3$ composer install

Fatal error: Call to undefined function Composer\Console\json_decode() in phar:///usr/local/bin/composer/src/Composer/Console/Application.php on line 127

I also tried to add 'extension=json.so' to my domain PHP additonal directive on Plesk Host Panel, with no effect.

Listing chroots directories :
Code:
root@vps:/var/www/vhosts/chroot/usr/lib# ls -al /var/www/vhosts/chroot/usr/lib
total 1596
drwxr-xr-x 6 root root    4096 Mar  4 19:41 .
drwxr-xr-x 7 root root    4096 Mar  4 19:28 ..
drwxr-xr-x 3 root root    4096 Feb  3 01:06 git-core
lrwxrwxrwx 6 root root      17 Feb  6 19:14 libperl.so.5.18 -> libperl.so.5.18.2
-rw-r--r-- 5 root root 1608280 Feb  6 19:14 libperl.so.5.18.2
drwxr-xr-x 2 root root    4096 Dec 29 16:49 openssh
lrwxrwxrwx 2 root root       4 Mar  4 19:41 php -> php5
drwxr-xr-x 4 root root    4096 Dec 29 16:45 php5
drwxr-xr-x 2 root root    4096 Mar  4 18:11 x86_64-linux-gnu
Code:
root@vps:/var/www/vhosts/chroot/usr/lib# ls -al /var/www/vhosts/chroot/usr/lib/php5
total 24
drwxr-xr-x 4 root root 4096 Dec 29 16:45 .
drwxr-xr-x 6 root root 4096 Mar  4 19:41 ..
drwxr-xr-x 2 root root 4096 Dec 30 22:11 20121212
drwxr-xr-x 2 root root 4096 Feb 18  2014 json
-rwxr-xr-x 6 root root  669 Oct 29 13:16 maxlifetime
-rwxr-xr-x 6 root root  347 Oct 29 13:16 sessionclean

Can someone help me to add json php module to my chrooted environment pls ?

Thanks
 
Last edited:
ah ok, i've fixed it by copying the ini files for php5-cli. For json, it was :
Code:
cp /etc/php5/cli/conf.d/20-json.ini /var/www/vhosts/chroot/etc/php5/cli/conf.d/20-json.ini
 
Back
Top