2013-04-28 2 views
18

this 기사를 사용하여 우분투 32 비트 12.10에서 실행되는 PHP 5.4.6에 pcntl을 설치했습니다.pcntl이 보안상의 이유로 우분투에서 작동하지 않습니다.

컴파일 후 실행 중일 때 make test에 다음과 같은 오류가 발생했기 때문에 원활하게 진행되지 않았습니다.

경고 : pcntl_fork()가 /var/www/mydev/dev/mailServiceTest.php에서 보안상의 이유로 중지 된 나는 말한다 자식 프로세스를 포크려고 할 때마다 경고를 얻고있다 on line 8

나는 웹상에서 해결책을 찾았지만, 불행히도 다른 곳에서는이 문제를 언급하지 않았다.

Build complete. 
Don't forget to run 'make test'. 
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0 
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0 

===================================================================== 
PHP   : /usr/bin/php 
Warning: Module 'pcntl' already loaded in Unknown on line 0 

PHP_SAPI : cli 
PHP_VERSION : 5.4.6-1ubuntu1.2 
ZEND_VERSION: 2.4.0 
PHP_OS  : Linux - Linux oleg-Lenovo-G580 3.5.0-26-generiC#42-Ubuntu SMP Fri Mar 8 23:20:06 UTC 2013 i686 
INI actual : /php/php-5.4.6/ext/pcntl/tmp-php.ini 
More .INIs : 
CWD   : /php/php-5.4.6/ext/pcntl 
Extra dirs : 
VALGRIND : Not used 
===================================================================== 
TIME START 2013-04-28 12:11:03 
===================================================================== 
FAIL Test pcntl wait functionality [tests/001.phpt] 
FAIL pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt] 
FAIL pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt] 
FAIL Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt] 
FAIL pcntl_alarm() [tests/pcntl_alarm.phpt] 
FAIL pcntl_exec() [tests/pcntl_exec.phpt] 
FAIL pcntl_exec() 2 [tests/pcntl_exec_2.phpt] 
FAIL pcntl_exec() 3 [tests/pcntl_exec_3.phpt] 
FAIL Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt] 
FAIL Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt] 
FAIL Test pcntl_get_last_error() [tests/pcntl_get_last_error.phpt] 
FAIL pcntl_signal() [tests/pcntl_signal.phpt] 
FAIL pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt] 
FAIL pcntl_wait() [tests/pcntl_wait.phpt] 
FAIL Closures as a signal handler [tests/signal_closure_handler.phpt] 
===================================================================== 
TIME END 2013-04-28 12:11:07 

===================================================================== 
TEST RESULT SUMMARY 
--------------------------------------------------------------------- 
Exts skipped : 0 
Exts tested  : 44 
--------------------------------------------------------------------- 

Number of tests : 15    15 
Tests skipped : 0 ( 0.0%) -------- 
Tests warned : 0 ( 0.0%) ( 0.0%) 
Tests failed : 15 (100.0%) (100.0%) 
Expected fail : 0 ( 0.0%) ( 0.0%) 
Tests passed : 0 ( 0.0%) ( 0.0%) 
--------------------------------------------------------------------- 
Time taken  : 4 seconds 
===================================================================== 

===================================================================== 
FAILED TEST SUMMARY 
--------------------------------------------------------------------- 
Test pcntl wait functionality [tests/001.phpt] 
pcntl: pcntl_sigprocmask(), pcntl_sigwaitinfo(), pcntl_sigtimedwait() [tests/002.phpt] 
pcntl: SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK [tests/003.phpt] 
Bug #47566 (return value of pcntl_wexitstatus()) [tests/bug47566.phpt] 
pcntl_alarm() [tests/pcntl_alarm.phpt] 
pcntl_exec() [tests/pcntl_exec.phpt] 
pcntl_exec() 2 [tests/pcntl_exec_2.phpt] 
pcntl_exec() 3 [tests/pcntl_exec_3.phpt] 
Test function pcntl_fork() by calling it with its expected arguments [tests/pcntl_fork_basic.phpt] 
Test function pcntl_fork() by testing the process isolation in the forking hierarchy father -> son -> grandson where father can not knows his grandson [tests/pcntl_fork_variation.phpt] 
Test pcntl_get_last_error() [tests/pcntl_get_last_error.phpt] 
pcntl_signal() [tests/pcntl_signal.phpt] 
pcnt_signal_dispatch() [tests/pcntl_signal_dispatch.phpt] 
pcntl_wait() [tests/pcntl_wait.phpt] 
Closures as a signal handler [tests/signal_closure_handler.phpt] 
===================================================================== 

You may have found a problem in PHP. 
This report can be automatically sent to the PHP QA team at 
http://qa.php.net/reports and http://news.php.net/php.qa.reports 
This gives us a better understanding of PHP's behavior. 
If you don't want to send the report immediately you can choose 
option "s" to save it. You can then email it to [email protected] later. 
Do you want to send this report now? [Yns]: y 

Please enter your email address. 
(Your address will be mangled so that it will not go out on any 
mailinglist in plain text): [email protected] 

Posting to http://qa.php.net/buildtest-process.php 

Thank you for helping to make PHP better. 
[email protected]:/php/php-5.4.6/ext/pcntl$ version 

다음 명령을 입력

, 그것은 내가 모든이 확장 설치하기 전에 PHP 인터프리터가 기능을 인식하지 않았지만 PHP 실제로 이미 설치되어있는 것 같습니다 :

[email protected]:/php/php-5.4.6/ext/pcntl$ php -m | grep pcntl 
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0 
pcntl 

을 어떻게 할 수 제대로 작동하려면이 기능을 구성하십시오.

+1

글쎄,'disable_functions' 설정에서 제거하십시오 .... ('php -d disable_functions = pcntl_fork -r 'pcntl_fork();'또는'php -d disable_functions = substr -r 'substr (1); ''그 문제에 대해). 웹 서버에서 포크하는 것은 나쁜 생각입니다. – Wrikken

+0

감사합니다. 그러나 CLI sapi에서이 스크립트를 사용하고 있으므로 괜찮습니다. –

답변

37

sudo는 gedit를

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

또는 \ 및

sudo gedit /etc/php5/apache2/php.ini 찾기 :

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 

주석이 아웃 : 나도이 확률값을했다

;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 
+7

흠, _cli_ 스크립트가/etc/php5/_apache2_/php.ini 파일을로드하는 이유는 무엇입니까? – Wrikken

+1

GUI를 사용하고 루트 액세스가 필요한 * 경우 * 대신 gksudo를 사용하십시오. http://askubuntu.com/a/11766/63492 –

+0

Hello Aditya, 지정된 대답은 홈 디렉토리에있는 파일을 편집하는 것에 대해 설명합니다. 수퍼 유저로서 php.ini 파일은 이미 웹 서버 사용자 (아파치의 경우 www-data)가 소유하고 있거나 악성 사례는 루트 사용자가 소유하고 있지만 사용자는 결코 소유하지 않습니다. –

0

흠. Ubuntu에는 /usr/share/php5에 몇 가지 샘플 PHP 구성 파일이 함께 제공됩니다. php.ini-production은 Apache 웹 서버 PHP 구성 (/etc/php5/apache2/php.ini)의 템플릿이며 pcntl_fork 및 다른 기능을 비활성화합니다. php.ini-production.cli은 테스트를 실행할 때를 포함하여 명령 줄 (/etc/php5/cli/php.ini)에서 실행되는 PHP 용 템플릿이며 기능을 비활성화하지 않습니다. 하지만 어쨌든 내 /etc/php5/cli/php.ini은 이러한 기능을 비활성화하는 Apache 구성의 사본이었습니다.

어떻게 이런 일이 일어 났는지 잘 모르겠습니다. 우분투 12.04로 램프 스택을 설치했습니다. 내 /etc/php5/cli/php.ini 파일이 2013 년 10 월 12 일자로 업데이트되어 우분투 13.10에서 제안되었습니다. 어쩌면 그 릴리스가 잘못된 파일을 복사했을 수도 있습니다. Ubuntu 업그레이드는 /usr/share/php5의 샘플 파일을 업데이트하지만 파일은 /etc/ 만 남겨 둡니다.

는 내가 기본 명령 줄 설정 파일을 복사
$ sudo cp -pi /usr/share/php5/php.ini-production.cli /etc/php5/cli/php.ini 

를 사용하여 고정합니다. 분명히 명령 줄 PHP5 설정을 변경했다면이를 덮어 씁니다. 유닉스 기술을 사용하여이를 비교하고 병합하십시오.

관련 문제