Enable PCNTL in Ubuntu PHP - test fails

前端 未结 5 1686
隐瞒了意图╮
隐瞒了意图╮ 2021-02-08 05:05

I need help on How to: Enable PCNTL in Ubuntu PHP.

$ mkdir /tmp/phpsource
$ cd /tmp/phpsource


$ wget http://museum.php.net/php5/php-5.3.2.tar.gz
$ tar xvf php-         


        
5条回答
  •  青春惊慌失措
    2021-02-08 05:51

    Here's what I've found in Ubuntu 12.04:

    • Check your PHP.ini for the pnctl functions being disabled.

      disable_functions =     pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
      
    • phpinfo reports the function is already loaded but it will not actually work without putting the pcntl.ini file into /etc/php5/conf.d.

    Sadly, this causes 'module already loaded' errors every time PHP session cleanup cron in /etc/cron.d kicks off, but PCNTL won't function without both of these pieces in place, and so far I haven't found a good solution to disable the 'already loaded' error. Its messy, and ugly, and spams my root mail, and when I can find a solution, I will post it. I've only run into this problem in 12.04 so far.

    UPDATE

    I hacked my /usr/lib/php5/maxlifetime script file to stop spamming with pnctl errors (PHP Warning: Module 'pcntl' already loaded in Unknown on line 0). Here are my edits - I specifically added in the 'E_DEPRECATED' line to quiet the messages.

    Line 8:

        cur=$(php5 -c /etc/php5/${sapi}/php.ini -d "error_reporting='E_ALL & ~E_DEPRECATED'" -r 'print ini_get("session.gc_maxlifetime");' 2> /dev/null)
    

提交回复
热议问题