I've been busting my head against the wall on this one for hours and I can't make any progress.
Right now I've simmered down my problem to the simple (maybe?) task of trying to get a PHP script to run a .bat program, on localhost. I'm using WAMP.
This is my current PHP file:
<?php system('cmd /c C:\Users\user\Desktop\open.bat'); ?>
That's all there is in it. My .bat file, which is on the desktop, contains:
notepad.exe C:\Users\user\Desktop\test.txt
And then I have a simple text file called test.txt on the desktop. I can run the .bat file from the command line and it works fine, but nothing from within the PHP.
There's numerous other threads here asking how to run a .bat from PHP (ex: How do you run a .bat file from PHP?), and I've tried pretty much every technique I've read about online, and NOTHING WORKS.
Ex, I've tried
exec('open.bat')
(with the .bat in the same directory), shell_exec()
, changing around the locations of files, paths, I really don't know what's up with it. I'm not running PHP in safe mode.
Perhaps there's some configuration that I should know about that will allow it to run? Or maybe I'm missing something painfully obvious...