Php – How to install php cli with pnctl alongside Zend Server

PHPzend

I have Zend Server CE 5.6 with PHP 5.2 running on Ubuntu 11.10. Now the need has arisen to run a command line PHP script that uses PHP's pnctl functionality.

First of all, I had no PHP command line in my path, so I made a symlink from the Zend one:

sudo ln -s /usr/local/zend/bin/php /usr/bin

However, when I run my script, I now get this error:

PHP Fatal error: Call to undefined function pcntl_fork()

The Zend web control panel doesn't offer pnctl in the list of modules, so how do I get this functionality?

Is it safe to use apt-get to install PHP directly, to run alongside the Zend instance? If so, how do I make sure I get version 5.2? I guess the following would pull in PHP 5.3:

apt-get install php5-cli

I could probably muddle through but any pointers to help me avoid making a mess would be much appreciated!

Best Answer

To install the extensionpcntl for apache:

cd path/to/php/ext/pcntl/
phpize && ./configure && make install
echo "extension=pcntl.so" >> /path/to/php.ini
apachectl restart

Checking if everything is ok.

php -m | grep pcntl

The outpout must be pcntl.

Related Topic