php多线程,安装好了,然后使用命令行可以运行。
比如:命令行输入
/usr/local/php-threads/bin/php AdvancedSynchronization.php
运行结果:
Process: running
ScopeTest: 140703850592000 running
ScopeTest2: 140703839512320 running
ScopeTest2: 140703839512320 working ...
ScopeTest2: 140703839512320 notified: 1
Process: notifying 140703839512320: 1
ScopeTest: 140703850592000 notified: 1
Process: notifying 140703850592000: 1 我想直接再浏览器上打开这个AdvancedSynchronization.php文件,但是浏览器没有反应。查看日志:
错误如下:
PHP Fatal error: class Thread can not found in ....可是我按照网上安装了Thread,命令行下都能运行。
我改怎么办才能让浏览器也能运行》????
求助
比如:命令行输入
/usr/local/php-threads/bin/php AdvancedSynchronization.php
运行结果:
Process: running
ScopeTest: 140703850592000 running
ScopeTest2: 140703839512320 running
ScopeTest2: 140703839512320 working ...
ScopeTest2: 140703839512320 notified: 1
Process: notifying 140703839512320: 1
ScopeTest: 140703850592000 notified: 1
Process: notifying 140703850592000: 1 我想直接再浏览器上打开这个AdvancedSynchronization.php文件,但是浏览器没有反应。查看日志:
错误如下:
PHP Fatal error: class Thread can not found in ....可是我按照网上安装了Thread,命令行下都能运行。
我改怎么办才能让浏览器也能运行》????
求助
他不是已经说了 Thread 类找不到吗?
你先看看扩展加载了没有,在看看该扩展提供的是类还是函数
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php-threadsb/php/extensions-debug-zts-20121212/pthreads.so' - /usr/local/php-threadsb/php/extensions-debug-zts-20121212/pthreads.so: undefined symbol: executor_globals_id in Unknown on line 0
[Mon Jun 16 23:35:36 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.11 with Suhosin-Patch configured -- resuming normal operations
[Mon Jun 16 23:35:41 2014] [error] [client 127.0.0.1] PHP Fatal error: Class 'Thread' not found in ar/www/test.php on line 16
[Mon Jun 16 23:49:17 2014] [error] [client 127.0.0.1] PHP Fatal error: Class 'Thread' not found in ar/www/test.php on line 16这个undefined symbol: executor_globals_id in Unknown on line 0,我网上查了很多资料,修改了很多次,还是不行。怎么办??
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php-threadsb/php/extensions-debug-zts-20121212/pthreads.so' - /usr/local/php-threadsb/php/extensions-debug-zts-20121212/pthreads.so: undefined symbol: executor_globals_id in Unknown on line 0
[Mon Jun 16 23:35:36 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.11 with Suhosin-Patch configured -- resuming normal operations
[Mon Jun 16 23:35:41 2014] [error] [client 127.0.0.1] PHP Fatal error: Class 'Thread' not found in ar/www/test.php on line 16
[Mon Jun 16 23:49:17 2014] [error] [client 127.0.0.1] PHP Fatal error: Class 'Thread' not found in ar/www/test.php on line 16这个undefined symbol: executor_globals_id in Unknown on line 0,我网上查了很多资料,修改了很多次,还是不行。怎么办??
模块已经添加了。php -m可以看到模块pthread。
我自己写了一个文件:
<?php
class AsyncOperation extends Thread {
public function __construct($arg){
$this->arg = $arg;
} public function run(){
if($this->arg){
printf("Hello %s\n", $this->arg);
}
}
}
$thread = new AsyncOperation("World");
$thread1 = new AsyncOperation("Jaffer");
$thread->start();
$thread1->start();
$thread->join();
$thread1->join();
?>
再浏览器上什么都没有。
我查看apache日志,发现没有日志生成。
如果直接调用/usr/local/php-zts/bin/php test.php是有结果输出的。那这是怎么回事?