Re: How to Execute Exe File from PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alice

First, make sure about the value on $market and $length. Yeah, it's simple.

 echo $market;
 echo $length;
 $a= shell_exec("./test.exe -m$market -d$length");
 echo $a;

Second: "http://www.chipmunkninja.com/Program-Execution-in-PHP:-exec-m@@";
A good explanation to use external commands (thanks chip!)

Third: give us more information: PHP version, OS. Maybe this time can be
useless, but important for future questions.

(sorry about my poor english)




2008/10/21 Alice Wei <ajwei@xxxxxxxxxxxxx>

>
>
>
> Hi, Guys:  Sorry about bothering everyone about this problem.  It seems
> strange that now I try to create some arguments after what I tried to
> execute, it does not give me a thing.
>  I get no error messages. No output file, and only a blank screen when I
> put the following snippet into the PHP file.
>  $a= shell_exec("./test.exe -m$market -d$length");
>  echo $a;
>  What is odd is, I tired doing this by using a dos command prompt, it works
> entirely. Could anyone please give me a hint on what problem I am having
> now?
> Thanks for the heads up.
>
> Alice
> > CC: php-general@xxxxxxxxxxxxx
> > From: stuttle@xxxxxxxxx
> > To: ajwei@xxxxxxxxxxxxx
> > Date: Mon, 20 Oct 2008 21:51:23 +0100
> > Subject: Re:  How to Execute Exe File from PHP
> >
> > On 20 Oct 2008, at 21:47, Alice Wei wrote:
> > >  Has anyone tried to execute an .exe file from PHP? I am
> > > currently stuck in a situation where I cannot execute the script, and
> > > all I am getting is a blank screen.
> > >
> > > This is my code snippet used to execute the file:
> > >
> > >  //execute program
> > > $a = @shell_exec("C:\Inetpub\wwwroot\test/test.exe");
> > > echo $a;
> > >
> > > The
> > > program above is supposed to generate a file, so I can read from it. I
> > > have previously set up a file, and I have no problems with reading the
> > > file.
> > > Can anyone please help me with the possible command to
> > > execute the script? I tried CURL too, but it does not seem to be
> > > working either.
> >
> > 1) Remove the @ before the function call, it's hiding the error message!
> >
> > 2) \ needs to be escaped within double quotes, try replacing each one
> > with \\
> >
> > 3) Why are you mixing \'s and /'s? Dunno whether it matters, but it's
> > definitely better to stick to one or the other.
> >
> > 4) There is no 4!
> >
> > -Stut
> >
> > --
> > http://stut.net/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> _________________________________________________________________
> Use Messenger to talk to your IM friends, even those on Yahoo!
>
> http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-685ee3e858fe

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux