pcntl not working on Ubuntu 'for security reasons'

后端 未结 2 792
悲哀的现实
悲哀的现实 2021-02-07 02:14

I have installed pcntl on my PHP 5.4.6 running on Ubuntu 32-bit 12.10, using this article.

It didn\'t go smoothly at all because after compiling, when running make

相关标签:
2条回答
  • 2021-02-07 02:45

    I too had this problem. Ubuntu ships with some sample PHP configuration files in /usr/share/php5: php.ini-production is the template for the Apache web server PHP config (/etc/php5/apache2/php.ini) and it disables pcntl_fork and other functions. php.ini-production.cli is the template for PHP run from the command line (/etc/php5/cli/php.ini) including when you're running tests, and it doesn't disable any functions. But somehow my /etc/php5/cli/php.ini was a copy of the Apache config which disables these functions.

    I'm not sure how this happened. I installed my LAMP stack with Ubuntu 12.04. My /etc/php5/cli/php.ini file dated from October 2013, suggesting Ubuntu 13.10 set it up; maybe that release copied the wrong file. Ubuntu upgrades update the sample files in /usr/share/php5 but leave the files in /etc/ alone.

    To fix it I used

    $ sudo cp -pi /usr/share/php5/php.ini-production.cli /etc/php5/cli/php.ini
    

    to copy the default command-line settings file. Obviously if you've made changes to the command-line PHP5 settings, this will overwrite them; use your UNIX skills to diff and merge them.

    0 讨论(0)
  • 2021-02-07 02:55

    sudo gedit

    sudo gedit /etc/php5/cli/php.ini
    

    or \ and

    sudo gedit /etc/php5/apache2/php.ini find:

    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
    

    Comment this out:

    ;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
    
    0 讨论(0)
提交回复
热议问题