Jump to content

Executing batch files.


ramarbstr12play

Recommended Posts

I am having an issue with batch files using Windows,Apache,Mysql,and PHP. Namely php running in appache on Windows. Basically i have gotten this far.

 

I was trying to execute a batch file from php using

 

 

Line number On/Off | Expand/Contract

exec('c:\mydir\mybatch.bat');

 

 

 

after alot of tweaking and fumbling around i have gotten my batch file to execute.

1. i run my batch file from the same folder the php file is in.

i.e:

Line number On/Off | Expand/Contract

exec("mybatch.bat");

 

 

 

2. i make sure that Apache Service has enough permission to run the batch file. Just to test i used an administartor account for Apache to log on with.

 

This is what i have done so far. I am able to call a batch file that uses "psexec" with a admin user account to run a program. But i get an error from windows everytime i run this php file. I cant remember the exact error and i will post it later.

 

But, it basically says that the program like "cmd" for example that is used to run another batch file can not run or has ancountered an error. The batch file runs perfect from Windows. But if it is called from PHP it gives an error.

 

I am stumped.

 

Can anyone help me?

Link to comment
https://forums.phpfreaks.com/topic/129901-executing-batch-files/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.