我需要有关如何:在Ubuntu PHP中启用PCNTL的帮助.
$ mkdir /tmp/phpsource
$ cd /tmp/phpsource
$ wget http://museum.php.net/php5/php-5.3.2.tar.gz
$ tar xvf php-5.3.2.tar.gz
$ cd php-5.3.2/ext/pcntl
$ phpize -bash: phpize: command not found
Run Code Online (Sandbox Code Playgroud)
一切都很顺利,直到我试图运行phpize!然后我得到错误'-bash:phpize:command not found'?? 有任何想法吗?
UPDATE运行:
$ sudo apt-get update
Run Code Online (Sandbox Code Playgroud)
然后跑:
$ sudo apt-get install php5-dev
Run Code Online (Sandbox Code Playgroud)
在尼克的帮助下,我设法完成了这个程序.但'make test'失败了?
$ phpize
$ ./configure
$ make
$ cp modules/pcntl.so /usr/lib/php5/20090626/
$ echo "extension=pcntl.so" > /etc/php5/conf.d/pcntl.ini
$ make test - FAILED!
Run Code Online (Sandbox Code Playgroud)
帮助:我键入'echo'extension = pcntl.so> /etc/php5/conf.d/pcntl.ini'而不是'echo"extension = pcntl.so"> /etc/php5/conf.d/pcntl.ini "我第一次跑这个.那是不是很糟糕?
---------------------------------制作TEst错误信息------------- -------------------------
PHP Deprecated: Comments starting with '#' are deprecated …Run Code Online (Sandbox Code Playgroud) 我不得不构建一个PHP Queue System,并发现了这篇精彩的文章
,我用它来创建一个PHP队列系统,它非常容易设置和使用.http://squirrelshaterobots.com/programming/php/building-a-queue-server-in-php-part-1-understanding-the-project
下面是queue.php的代码,从shell(puTTy或somesuch)运行.
<?PHP
//. set this constant to false if we ever need to debug
//. the application in a terminal.
define('QUEUESERVER_FORK', true);
//////// fork into a background process ////////
if(QUEUESERVER_FORK){
$pid = pcntl_fork();
if($pid === -1) die('error: unable to fork.');
else if($pid) exit(0);
posix_setsid();
sleep(1);
ob_start();
}
$queue = array();
//////// setup our named pipe ////////
$pipefile = '/tmp/queueserver-input';
if(file_exists($pipefile))
if(!unlink($pipefile))
die('unable to remove stale file');
umask(0);
if(!posix_mkfifo($pipefile, 0666))
die('unable to create named pipe'); …Run Code Online (Sandbox Code Playgroud)