0

我已经接管了一个项目,并试图让它在我的服务器上运行....虽然我似乎遇到了系统守护程序的以下问题(代码如下)

我已经安装了 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();
}
4

1 回答 1

1

PHP System_Daemon 包只能在命令行脚本中使用。它不能在从 Web 服务器运行的脚本中使用,这似乎是您在这里尝试使用它的方式。

于 2014-07-24T18:36:42.547 回答