Use php exec(), php_exec() wamp server windows 8

Steps:

Turn off safe mode in php.ini
(Make sure you are editing the correct php.ini that corresponds to the right version of active php e.g. D:\wamp\bin\php\php5.3.5\php.ini)

safe_mode = Off
safe_mode_exec_dir = Off

Usage:

If you have myexecutable.exe in the same folder with test.php in your local server. Accessing http://localhost/test.php. You should see the output message of your executabe.
 
test.php
<?php
exec("myexecutable.exe", $output);
var_dump($output); 

//Page will not wait for the executable to finish. Uncomment pclose()if you
//don't want the page to load waiting for the exe to finish
//http://www.php.net/manual/en/function.exec.php
//pclose(popen("start /B myexecutable.exe", "r"));
 
?>

The page will wait for the executable to finished.



Comments

Popular posts from this blog

Basic Authentication Using .htaccess In Wamp/Xampp Server

Prevent parent anchor tag to redirect when a child is clicked