jjzjj

PHP-FPM 和 pthreads

我正在使用PHP-FPM运行Phalcon应用程序,并且刚刚安装了pthreads,因此我可以开始异步运行任务。我目前有pthreads使用命令行界面工作:workerId=$id;}publicfunctionrun(){usleep(2000000);//2secondsecho"Worker{$this->workerId}ran".PHP_EOL;}}//Workerpool$workers=[];//Initializeandstartthethreadsforeach(range(0,5)as$i){$workers[$i]=newWorkerThreads($i);$wo

php - Apache2,线程。 fatal error 。 pthreads 不支持 apache2handler SAPI

我的ubuntu上有apache2网络服务器。我需要安装pthreads,所以我从rep(复制到/ext/)克隆了php7和pthreads的源代码。我为php安装了所有库,然后运行​​./buildconf和./configure--prefix=/usr--with-config-file-path=/etc--enable-bcmath--enable-calendar--enable-cli--enable-debug--enable-dba--enable-exif--enable-ftp--enable-gd-native-ttf--enable-mbregex--enab

php - 在 Ubuntu 上的 PHP+Apache2 中启用线程安全 - 使用 pthreads 从源代码编译 php

在我通过apt-get安装Apache2和PHP5后,我试图让pthreads在我的Ubuntu服务器(14.04)上运行。我的初始步骤:已安装apache2-apt-getinstallapache2使用常用模块安装php5apt-getinstallphp5libapache2-mod-php5php5-mcrypt...然后我按照本教程让pthreads运行(Usercontributedmanualonphp.net):1-GetPHPversionForthisexamplewewilluseversion:5.4.36#wgethttp://www.php.net/dist

php - PHP Pthread 类中的 Yii 框架上下文

我正在研究PHPPthreads.我写了一个继承“Thread”类的类。此类不识别Yii(1.x)框架上下文。我不能使用任何Yii框架组件或模型。我已经确保线程类应该驻留在Yii框架的可访问路径中,该路径在配置的“导入”中定义。这是我如何编写线程类的示例。basePath;}}更新:这是Yii配置中的导入器数组。'import'=>array('application.models.*','application.components.*','application.components.multithreaded-operations.*','application.componen

php - 如何使用 pthreads 重新编译 PHP7

我已经安装并正常运行php7buildwith-enable-zts(https://github.com/rlerdorf/php7dev)现在我需要添加pthreads扩展(https://github.com/krakjoe/pthreads),但出现一些错误:Infileincludedfrom/home/pthreads/php_pthreads.c:47:0:./src/copy.h:113:8:error:unknowntypename‘zend_live_range’staticzend_live_range*pthreads_copy_live(zend_live_r

PHP pthreads : Difference between Threaded and Stackable

我对这两个类之间的区别感到困惑Threaded和Stackable在pthreadsPHP扩展。PHP手册页没有提到Stackable,但它存在并且许多关于pthreads的文本都提到了这个类;例如:RecyclingContextsMulti-ThreadinginPHPwithpthreadsEasypthreadsPools调用get_class_methods()显示这两个类实现相同的方法和get_parent_class()两者都返回FALSE。目前我假设Stackable是Threaded的别名。对吗? 最佳答案 $st

php - 无法加载动态库 'C:\php\ext\php_pthreads.dll'

我试图在我的php代码中加入线程,但我无法理解pthreads库,每次运行我的程序时我都会遇到这个错误:Warning:PHPStartup:Unabletoloaddynamiclibrary'C:\php\ext\php_pthreads.dll'-Thespecifiedmodulecouldnotbefound.inUnknownonline0我遵循了所需的每个步骤:I'veaddedthefilepthreadVC2.dllinmy"C:\php"folderI'veaddedthefilephp_pthreads.dllinmy"C:\php\ext"folderI'vem

php - 如何在 PHP7 中使用 pThreads 实现多线程? worker 、游泳池等

我目前想学习和实现pthreads-github.我用必要的组件编译了php7并验证了thread-safety已启用。我当前的示例代码有4个属于父类Canine的子类。我应该如何相应地调用Thread类以同时从下面显示的所有类执行bark()?记住当类从4增加到100时的扩展能力。池?工作人员?classDatabase{private$_host;private$_user;private$_pass;private$_dbname;private$_dsn;private$_options;publicstatic$pdo;private$error;private$stmt;p

php - 在 Windows 中安装 pThreads

谁能指导我在Windows中安装pThreads。实际上我想在PHP中启用线程。require_once('Thread.php');//testtoseeifthreadingisavailableif(!Thread::available()){die('Threadsnotsupported');}//functiontoberanonseparatethreadsfunctionparalel($_limit,$_name){for($index=0;$indexstart(10,'t1');$t2->start(10,'t2');//keeptheprogramrunning

PHP 线程 ( pthreads ) 正在工作,但没有任何 Stackable 类

最近几天我将PHP线程(pthreads)与PHP7.0.1(在配置中使用–enable-maintainer-zts)一起使用,并且在使用Thread或Worker时一切正常。当我尝试为Worker创建一个继承自Stackable的类时,我得到了“fatalerror:未找到类‘Stackable’”。通过get_declared_classes()我意识到对于线程我只有Threaded、Volatile、Thread、Worker和Pool类。我以为是pthreads版本的问题(最新的是3.1.15)但是卸载了再安装回3.0.0还是出现了同样的错误。此外,PHP手册(英文)也没有提