简体   繁体   中英

Can't Execute a PHP file via HTTP

Here is a command I successfully execute in terminal:

PHP process_scan.php

I want to execute that code every time a user visits a file, which exists in the same directory as the file mentioned in the command.

Here is the code in the file:

exec('PHP process_scan.php 2>&1', $output, $retval);

Running the file in the browser, $retval = 127 wit $output = "sh: PHP: command not found" .

How can I successfully run the command every time a user visits the file?

我没有引用 PHP,而是通过执行 PHP bin 文件来实现它:

exec('/usr/bin/php process_scan.php 2>&1', $output, $retval);

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