batch file issue...

batch file issue...

am 15.01.2008 18:22:52 von Mandragon03

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...

am 15.01.2008 18:25:08 von luiheidsgoeroe

On Tue, 15 Jan 2008 18:22:52 +0100, 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

Re: batch file issue...

am 15.01.2008 19:22:17 von Mandragon03

On Jan 15, 10:25 am, "Rik Wasmus" wrote:
> On Tue, 15 Jan 2008 18:22:52 +0100, 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!

Re: batch file issue...

am 15.01.2008 22:38:53 von Daniel Ennis

Mandragon03@gmail.com wrote:
> On Jan 15, 10:25 am, "Rik Wasmus" wrote:
>> On Tue, 15 Jan 2008 18:22:52 +0100, 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@fanetworks.net