batch file issue...

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I am using php 5.2.5 via a wamp server on my machine. I have created a
web interface to a mysql database using  php. The web interface has a
link to a php file which calls a dos batch file like this:

$Text = shell_exec("c:\mydatabase\convertdb.bat $Language");

where $Language is set to "English"  or "Chinese" etc etc ( I verified
that it has the correct value ).

The batch file contains a call to mysqldump.exe.

 I can run the batch file manually and it works fine, however the
batch file will not execute through the php script as called from the
web interface I created for it.

On a side note If I make a call like this:

$Text = shell_exec("dir");
echo "$Text";

it works fine.

It seams to me like a permissions issue or some security configuration
that will not allow you to call batch files. I have been looking at
safe_mode but have not had any success.

Any ideas?

Thank you for your time!

Re: batch file issue...

Quoted text here. Click to load it

If you use \ or / instead of a single \ , does the problem persist?
-- =

Rik Wasmus

Re: batch file issue...

Quoted text here. Click to load it

using this did work!

$Text = shell_exec("c:\mydatabase\convertdb.bat $Language");

Thanks for the help!

Re: batch file issue... wrote:
Quoted text here. Click to load it

It's because shell_exec("c:\mydatabase\convertdb.bat $Language"); is  
actually: c:mydatabaseconvertdb.bat
Daniel Ennis - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years

Site Timeline