我接管了一个项目并试图让它在我的服务器上运行....虽然我似乎遇到了系统守护进程的以下问题(下面的代码)
我安装了pcntl:
php -i |grep pcnt
pcntl
pcntl support => enabled
所以不确定为什么我会收到此错误。谁能看到我做错了什么?
任何建议都将不胜感激!
谢谢!
queue.php(浏览器)
#!/usr/bin/php -q
Fatal error: Uncaught System_Daemon_Exception:
PHP is compiled without --enable-pcntl directive in
/home/***/public_html/videoenc/scripts/tools/videoserver/queue.php on line 66
Exception trace # Function Location 0 System_Daemon::start()
/home/***/public_html/videoenc/scripts/tools/videoserver/queue.php:66
1 {main
thrown in /usr/local/lib/php/System/Daemon.php on line 551
queue.php(代码)
#!/usr/bin/php -q
<? @set_time_limit(0);
define("DB_FORCE_USE_RW_SERVER", 1);
require_once(realpath(dirname(__FILE__) . "/../../common.inc.php"));
require_once "System/Daemon.php";
// Allowed arguments and their defaults
$runmode = array(
'no-daemon' => false,
'help' => false,
'write-initd' => false,
);
if(gettype($argv) != 'NULL')
{
foreach ($argv as $k => $arg)
{
if (substr($arg, 0, 2) == '--' && isset($runmode[substr($arg, 2)]))
$runmode[substr($arg, 2)] = true;
}
}
// Help mode. Shows allowed arguments.
if ($runmode['help'] == true)
{
echo 'Usage: ' . $argv[0] . "' [runmode]\n";
echo "Available runmodes:\n";
foreach ($runmode as $runmod => $val)
{
echo ' --'. $runmod . "\n";
}
die();
}
// Setup
$options = array(
'appName' => 'videoenc-queue',
'appDir' => dirname(__FILE__),
'appDescription' => 'Manages the video encoding queue.',
'authorName' => 'Dave',
'authorEmail' => 'dave@***',
'sysMaxExecutionTime' => '0',
'sysMaxInputTime' => '0',
'sysMemoryLimit' => '1024M',
'appRunAsGID' => 2000,
'appRunAsUID' => 2000,
'appPidLocation' => '/home/***/public_html/videoenc/daemon/run/videoenc-queue/videoenc-queue.pid',
'logLocation' => '/home/***/public_html/videoenc/daemon/log/videoenc-queue.log'
);
System_Daemon::setOptions($options);
// This program can also be run in the foreground with runmode --no-daemon
if (!$runmode['no-daemon'])
{
// Spawn Daemon
System_Daemon::start();
}
答案 0 :(得分:1)
PHP System_Daemon包只能在命令行脚本中使用。它不能在从Web服务器运行的脚本中使用,这似乎是您在此处尝试使用它的方式。