Search code examples
phpshellphilips-hue

Cannot Execute PHP Shell Script from Web Page


I have this file on my server to control my Philips Hue lights.

From the shell I run php huecli.php -i IP -k KEY ... it will output the proper result but when I run the following as a PHP Script, it fails (times out)

$output = shell_exec('php huecli.php ...');
echo "<pre>$output</pre>";

When I stop the script from running, I see there are a lot of outputs that look like:

X-Powered-By: PHP/5.5.30

Content-type: text/html


Solution

  • Figured out the issue. Apparently this was the same reason as This User. When I would call my file, it would apparently create thousands of processes, which is why it would timeout.

    Calling php-cli huecli.php solves my issue.