Reputation: 7525
I have taken over a project and im trying to get it working on my server....though I seem to be having the following problem with the System Daemon (code below)
I have pcntl installed:
php -i |grep pcnt
pcntl
pcntl support => enabled
So not sure why I am getting this error. Can anyone see anything I am doing wrong?
Any suggestions would be greatly appreciated!
Thanks!
queue.php (browser)
#!/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 (code)
#!/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();
}
Upvotes: 0
Views: 405
Reputation:
The PHP System_Daemon package can only be used in a command-line script. It cannot be used in scripts run from a web server, which appears to be how you're trying to use it here.
Upvotes: 1