i’m running WAMP.
When I do:
1. run cmd
2. cd c:\wamp\bin\php\php5.3.5\
3. press enter
4. php c:\wamp\www\cmdtest\index.php
5. press enter
I got the expected output.
But when I do it in the browser, i accessed localhost/cmdtest/exec.php with code:
<?php
exec('php c:\wamp\www\cmdtest\sample.php', $output);
var_dump($output);
?>
The output is empty.
I already set the user of wampapache in services.msc and restart wamp, nothing was fixed…
Any idea why or anyone knows a fix? Thanks in advanced!
Have you tried escaping the backslashes?
See also: http://www.tuxradar.com/practicalphp/2/6/2