Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 php5-cli

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

share|improve this question
add comment

2 Answers

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
share|improve this answer
    
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
add comment

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):

/usr/local/zend/lib/php_extensions/pcntl.so

Then, configured PHP to use it with this line:

extension=pcntl.so

(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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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