Run Windows Exe From PHP

Run a Windows Program With PHP On XAMP or WAMP

Here is an example of using a Windows Program within PHP. The example will use the software called httrack.

The code belows shows how the PHP exec() function is using the httrack.exe file. 

 exec('C:\Users\username\Documents\AAA\WinHTTrack\httrack.exe http://' . $url . '/  -O "C:\xampp\htdocs\CLONES\' . $url . '"  -%v -%e0 2>&1;'); 


By default, httrack install to Program Files. That white space between 'Program' and 'Files' on Windows will cause issues. So, you can copy the entire WinHTTrack folder to a path that has no whitespace. In this case, it was copied into the Documents\AAA folder.

By default, you will be able to use the service now, but, it could time out when cloning a website.

An example of a timeout is:

Fatal error: Maximum execution time of 30 seconds exceeded

To alter the timeout setting,
1. Open the file:
2. Change:

Change to:
3. Save the file and restart Apache. See setup, cloning and quick usage in action.