batch file issue...

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!
Mandragon03 [ Di, 15 Januar 2008 18:22 ] [ ID #1908566 ]

Re: batch file issue...

On Tue, 15 Jan 2008 18:22:52 +0100, <Mandragon03 [at] gmail.com> wrote:

> 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 =3D shell_exec("c:\mydatabase\convertdb.bat $Language");

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

Rik Wasmus
luiheidsgoeroe [ Di, 15 Januar 2008 18:25 ] [ ID #1908570 ]

Re: batch file issue...

On Jan 15, 10:25 am, "Rik Wasmus" <luiheidsgoe... [at] hotmail.com> wrote:
> On Tue, 15 Jan 2008 18:22:52 +0100, <Mandrago... [at] gmail.com> wrote:
> > 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");
>
> If you use \\ or / instead of a single \ , does the problem persist?
> --
> Rik Wasmus

using this did work!

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

Thanks for the help!
Mandragon03 [ Di, 15 Januar 2008 19:22 ] [ ID #1908579 ]

Re: batch file issue...

Mandragon03 [at] gmail.com wrote:
> On Jan 15, 10:25 am, "Rik Wasmus" <luiheidsgoe... [at] hotmail.com> wrote:
>> On Tue, 15 Jan 2008 18:22:52 +0100, <Mandrago... [at] gmail.com> wrote:
>>> 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");
>> If you use \\ or / instead of a single \ , does the problem persist?
>> --
>> Rik Wasmus
>
> using this did work!
>
> $Text = shell_exec("c:\\mydatabase\\convertdb.bat $Language");
>
> Thanks for the help!
>

It's because shell_exec("c:\mydatabase\convertdb.bat $Language"); is
actually: c:mydatabaseconvertdb.bat
--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
daniel [at] fanetworks.net
Daniel Ennis [ Di, 15 Januar 2008 22:38 ] [ ID #1908611 ]
PHP » comp.lang.php » batch file issue...

Vorheriges Thema: php script as a cron job
Nächstes Thema: Re: need help opening *.php