简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM