exec not working in php script ( WAMP Server )

筅森魡賤 提交于 2019-12-11 13:43:49

问题


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.


回答1:


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




回答2:


use this command

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


来源:https://stackoverflow.com/questions/14680605/exec-not-working-in-php-script-wamp-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!