What is linux equivalent of running a .bat file on windows from PHP using system()
Posted
by undefined
on Stack Overflow
See other posts from Stack Overflow
or by undefined
Published on 2010-05-11T14:40:55Z
Indexed on
2010/05/11
14:44 UTC
Read the original article
Hit count: 194
I have a PHP script that runs a .bat file on my windows machine using
$result = system("cmd /C nameOfBatchFile.bat");
This sets some environmental variables and is used to call Amazon EC2 API from the command line.
How do I do the same from a Linux server? I have renamed my .bat file to a shell (.sh) and changed the script to use 'export' when setting env vars. I have tested by running the code from a putty terminal and it does what it should. So I know the commands in the script are good. How do I run this from PHP? I have tried running the same command as above with the new filename and I don't get any errors, or file not found etc but it doesn't appear to work.
Where do I start trying to solve this?
© Stack Overflow or respective owner