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!


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.


First of all, don't use symlink. Instead, extend your $PATH :

export PATH=$PATH:/usr/local/zend/bin:/usr/local/zend/sbin

(you can put that in your $HOME/.bashrc)

Second point, pcntl is not a module, it is compiled inside PHP. You are probably missing some library path. Try something like that before calling php :

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/zend/lib::/usr/local/zend/lib64
  • Thanks for the quick answer. First point works a treat, no need for symlink anymore. Second point didn't make any difference (left out the lib64 because it isn't present). Which directory within lib should contain the pnctl module, and what should it be called?
    – fazy
    Feb 6 '12 at 16:30

Perhaps not a satisfactory answer, but I "solved" the problem in the end by copying the following file from another virtual machine I had access to, which happened to have a working installation (both are PHP 5.2.* and 64-bit Ubuntu):


Then, configured PHP to use it with this line:


(the above can probably go in php.ini, but I put it in /usr/local/zend/etc/ext.d/pcntl.ini and linked into /usr/local/zend/etc/conf.d).

However, I still can't explain why this file is missing in a brand new Zend installation. Also, I would not like to just copy a .so file from another machine without being 100% of compatability, but it appears to be running without any problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.