anneaquilino
asked on
How to run a batch file from PHP...exec() and system() not working.
Hi,
I am trying to run a batch file from PHP. It works fine when run manually but when I try to call it from within PHP it doesn't run. I've tried with exec() and system() with no luck. Here is my code:
system("\\qcwbfxd1\webdata \fxhome\fx \chartupda te\convert image.bat" , $output);
or
exec("\\qcwbfxd1\webdata\f xhome\fx\c hartupdate \convertim age.bat", $output);
$output returns a 1 in both cases.
Any help would be greatly appreciated.
Thanks, Anne
I am trying to run a batch file from PHP. It works fine when run manually but when I try to call it from within PHP it doesn't run. I've tried with exec() and system() with no luck. Here is my code:
system("\\qcwbfxd1\webdata
or
exec("\\qcwbfxd1\webdata\f
$output returns a 1 in both cases.
Any help would be greatly appreciated.
Thanks, Anne
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
From a dos prompt:
C:\WINDOWS\system32>cacls cmd.exe /E /G ServerName\IUSR_ServerName
Here is how to use cacls:
CACLS filename [/T] [/E] [/C] [/G user:perm] [/R user [...]]
[/P user:perm [...]] [/D user [...]]
filename Displays ACLs.
/T Changes ACLs of specified files in
the current directory and all subdirectories.
/E Edit ACL instead of replacing it.
/C Continue on access denied errors.
/G user:perm Grant specified user access rights.
Perm can be: R Read
W Write
C Change (write)
F Full control
/R user Revoke specified user's access rights (only valid with /E).
/P user:perm Replace specified user's access rights.
Perm can be: N None
R Read
W Write
C Change (write)
F Full control
/D user Deny specified user access.
Wildcards can be used to specify more that one file in a command.
You can specify more than one user in a command.
Abbreviations:
CI - Container Inherit.
The ACE will be inherited by directories.
OI - Object Inherit.
The ACE will be inherited by files.
IO - Inherit Only.
The ACE does not apply to the current file/directory.