简体   繁体   中英

exec not working in php script ( WAMP Server )

I am using WAMP server on my system to execute php scripts.

I want to execute a script test.php from my main script main.php .

For that I am using exec function like this exec('php test.php'); . In test.php I have given one echo statement.

But when I run my main.php script from the browser I am not able to see output of test.php script.

What am I doing wrong ? please suggest.

You have to give the proper path of php.exe

exec("c:\wamp\<where ever you exe is>/php.exe test.php");

so it has to be a proper path

use this command

echo exec('php test.php', $output);  //this will print your echo statement.
print_r($output);

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