对于我正在处理的一个项目,我正在生成多个工作进程。问题是,它们不会出现在苹果的活动监视器中,因为它们没有合适的标题集。
我尝试使用PHP5.5之后提供的cli_set_process_title函数。不幸的是,这是XDebug将我固定在控制台上的原因:
Warning: cli_set_process_title(): cli_set_process_title had an error: Not initialized correctly in /Users/Ingwie/Work/BIRD3/php-lib/yii_worker.php on line 22
Call Stack:
0.0012 264080 1. {main}() /Users/Ingwie/Work/BIRD3/php-lib/request_handler.php:0
0.0286 1219016 2. Workerman\Worker::runAll() /Users/Ingwie/Work/BIRD3/php-lib2015-07-01T20:12:03.185Z - info: BIRD3 worker@41603 is online!
/request_handler.php:103
0.0315 1252488 3. Workerman\Worker::forkWorkers() /Users/Ingwie/Work/BIRD3/php_modules/walkor/workerman/Worker.php:328
0.0507 1254312 4. Workerman\Worker::forkOneWorker() /Users/Ingwie/Work/BIRD3/php_modules/walkor/workerman/Worker.php:748
0.0561 1252896 5. Workerman\Hprose->run() /Users/Ingwie/Work/BIRD3/php_modules/walkor/workerman/Worker.php:779
0.0561 1253744 6. Workerman\Worker->run() /Users/Ingwie/Work/BIRD3/php_modules_ext/hprose-workerman/HproseWorkermanService.php:142
0.0591 1316400 7. call_user_func() /Users/Ingwie/Work/BIRD3/php_modules/walkor/workerman/Worker.php:1286
0.0591 1316472 8. AppServer::{closure:/Users/Ingwie/Work/BIRD3/php-lib/request_handler.php:38-40}() /Users/Ingwie/Work/BIRD3/php_modules/walkor/workerman/Worker.php:1286
0.0592 1316920 9. AppServer::emit() /Users/Ingwie/Work/BIRD3/php-lib/request_handler.php:39
0.0592 1318152 10. call_user_func_array() /Users/Ingwie/Work/BIRD3/php-lib/request_handler.php:76
0.0593 1318224 11. Evenement\EventEmitter->emit() /Users/Ingwie/Work/BIRD3/php-lib/request_handler.php:76
0.0593 1318320 12. call_user_func_array() /Users/Ingwie/Work/BIRD3/php_modules/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
0.0593 1318704 13. {closure:/Users/Ingwie/Work/BIRD3/php-lib/yii_worker.php:21-25}() /Users/Ingwie/Work/BIRD3/php_modules/evenement/evenement/src/Evenement/EventEmitterTrait.php:64
0.0593 1318800 14. cli_set_process_title() /Users/Ingwie/Work/BIRD3/php-lib/yii_worker.php:22proctitle扩展设置了一个非常奇怪的标题。它不会出现在活动监视器上,但会显示在ps中
504 44278 44261 0 10:44pm ttys000 0:00.00 BIRD3: Workerman Worker local/etc/fish __fish_runtime_dir=/tmp/fish.Ingwie __fish_help_dir=/usr/local/share/doc/fish __fish_datadir=/usr/local/share/fish __fish_bin_dir=/usr/local/bin这还不是我所有的环境变量。
正如您所看到的,似乎无法设置流程标题。
还是你认识一个?
PHP: 5.5.20 OS X: 10.10.3
PHP由操作系统提供:
Ingwie@Ingwies-MBP ~/W/BIRD3 $ php-config --configure-options
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-config-file-scan-dir=/Library/Server/Web/Config/php --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --disable-cgi --with-curl=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-fpm --enable-ftp --with-png-dir=no --with-gd --with-jpeg-dir=/usr/local --enable-gd-native-ttf --with-icu-dir=/usr --with-ldap=/usr --with-ldap-sasl=/usr --with-libedit=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=mysqlnd --without-pear --with-pear=no --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-iconv-dir=/usr --with-xsl=/usr --enable-zend-multibyte --enable-zip --with-pcre-regex=/usr发布于 2015-07-02 06:16:31
似乎必须是超级用户才能在MacOS 10.10.x上使用此功能。
很抱歉,无法帮助您解决此问题。
链接到有关此问题的高级讨论:Cannot set process title in a PHP command line script using cli_set_process_title() OS X?
https://stackoverflow.com/questions/31172440
复制相似问题