Mayank
Mayank

Reputation: 1139

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.

Upvotes: 1

Views: 4034

Answers (2)

rohitarora
rohitarora

Reputation: 1365

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

Upvotes: 2

Yogesh Suthar
Yogesh Suthar

Reputation: 30488

use this command

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

Upvotes: 1

Related Questions