I've installed Debian 6.0.6 x86 on a VPC with the least possible software packages and when the installation completes I take a backup of the VPC and put it aside for later use.
I have installed PHP 5 via aptitude install php5
and create a PHP script file with the following content and call it test.php:
if ( function_exists("chroot") ) { echo "Function works !\n"; } else { echo "Function does NOT work !\n"; }
When I run the script via command line php -f test.php
it shows me Function works ! Everything fine so far.
Since the PHP version within the php5 package is pretty old I would like to compile my own version - currently 5.4.13 - so I restore my back-upped VPC image and compile it with the following parameters:
./configure --with-apxs2=/usr/bin/apxs --with-config-file-path=/etc/php --with-zlib-dir=/usr/local/zlib --with-bz2=/usr/local/bzip2 --with-openssl=/usr/local/ssl --with-curl=/usr/local/curl --enable-mbstring --enable-intl
Output shows me:
Running system checks checking for chroot... yes
And the compile, make and make install completes flawlessly.
When I recreate and run the test.php script now I get the message Function does NOT work !
.
What is going on here I ask myself, am i running the script the wrong way since the documentation says the following: This function is only available to GNU and BSD systems, and only when using the CLI, CGI or Embed SAPI. Also, this function requires root privileges. or is there something not configured correctly ?
Update:
The reason why i try to get this chroot function to work is because i want to install Symfony2. When i run php composer.phar create-project symfony/framework-standard-edition /var/www/symfony2
from within the /root
folder it throws me an error:
PHP Fatal error: require_once(): Failed opening required 'app/autoload.php' (include_path='.:/usr/local/lib/php') in /var/www/symfony2/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 24
However when i install the php5 package via the apt-get manager and run the same composer command it works perfectly. With the precompiled deb php5 package the script changes the current working directory to /var/www/symfony2
while my compiled php binary doesn't (i think). Then i figured out my php version doesn't have any chroot function so i thought this could be the culprit.