Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I <3 myself sooo Much :) It works now like a charm I am successfully
finished:D
this is my SIMPLE solution no need to set path files! :D
echo exec('C:\WINDOWS\system32\cmd.exe');
echo exec('gams.exe trnsport_php.gms');
It works like a charm:)

On Fri, Feb 17, 2012 at 6:34 PM, Negin Nickparsa wrote:

> I found the correct one:
>
> $cmd = 'C:\Progra~1\GAMS23.7\gams.exe'.'
> '.escapeshellarg('C:\Progra~1\GAMS23.7\trnsport_php.gms').' 2>&1';
> $out = `$cmd`;
> var_dump($out);
>
> It will show NULL,so No error
> and I am sure it is correct because If I change gams.exe to egams.exe it
> recognizes
> but
> It can't run through system
> so my problem in path file has solved here Thanks to All of you.
> now I should find some solutions for permissions It doesn't relate to
> address file if I'm correct
>
> On Fri, Feb 17, 2012 at 5:27 PM, Negin Nickparsa wrote:
>
>> :)
>>
>>
>> On Fri, Feb 17, 2012 at 5:27 PM, Fatih P. wrote:
>>
>>> well then fix it. i m not using editor.
>>>
>>
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I found the correct one:

$cmd = 'C:\Progra~1\GAMS23.7\gams.exe'.'
'.escapeshellarg('C:\Progra~1\GAMS23.7\trnsport_php.gms').' 2>&1';
$out = `$cmd`;
var_dump($out);

It will show NULL,so No error
and I am sure it is correct because If I change gams.exe to egams.exe it
recognizes
but
It can't run through system
so my problem in path file has solved here Thanks to All of you.
now I should find some solutions for permissions It doesn't relate to
address file if I'm correct
On Fri, Feb 17, 2012 at 5:27 PM, Negin Nickparsa wrote:

> :)
>
>
> On Fri, Feb 17, 2012 at 5:27 PM, Fatih P. wrote:
>
>> well then fix it. i m not using editor.
>>
>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
:)

On Fri, Feb 17, 2012 at 5:27 PM, Fatih P.  wrote:

> well then fix it. i m not using editor.
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
well then fix it. i m not using editor.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
it's wrong Fatih because it shows me another color in editor

On Fri, Feb 17, 2012 at 5:24 PM, Negin Nickparsa wrote:

> Fatih what is about another parts?
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Fatih what is about another parts?


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 3:43 PM, Negin Nickparsa wrote:

> Fatih C:\Program Files\GAMS23.7 this is where my Gams is.
> maybe the problem is with permissions
> what should I do for permissions?
> what shoud I do to write this path file:'(
> I need it!
> when echo system('dir')
> shows me files of C:\Program Files\GAMS23.7
> then it shoud run the command gams.exe transport.gms without giving
> pathfiles
>
> what's wrong here?
> what reason is here for setting path files?
>
>
> On Fri, Feb 17, 2012 at 5:06 PM, Fatih P. wrote:
>
>> ERRORNULL
>> maybe program Files which has space should have something like \ which I
>> don't know ha?
>> or because of Null It is correct?
>>
>> means false.. it cannot find the path. you have problem with path.
>>
>
>
for path:
$path = "\"C:/Program Files/GAMS23.7/gams.exe"\";

qoute the paths using \" double quoutes outside. then pass them.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Fatih C:\Program Files\GAMS23.7 this is where my Gams is.
maybe the problem is with permissions
what should I do for permissions?
what shoud I do to write this path file:'(
I need it!
when echo system('dir')
shows me files of C:\Program Files\GAMS23.7
then it shoud run the command gams.exe transport.gms without giving
pathfiles

what's wrong here?
what reason is here for setting path files?

On Fri, Feb 17, 2012 at 5:06 PM, Fatih P.  wrote:

> ERRORNULL
> maybe program Files which has space should have something like \ which I
> don't know ha?
> or because of Null It is correct?
>
> means false.. it cannot find the path. you have problem with path.
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
ERRORNULL
maybe program Files which has space should have something like \ which I
don't know ha?
or because of Null It is correct?

means false.. it cannot find the path. you have problem with path.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Curtis I wrote this one as you said:

if(system("C:\/Program\ Files\\GAMS23.7\\gams.exe \"C:\/Program\
Files\GAMS23.7\trnsport_php.gms"))
echo 'No Error';
else echo 'Error';

how to set the path file correct?I really need it
Does anyone has a good reference showing me how to write path files in php
from windows Xp running Apache server?

On Fri, Feb 17, 2012 at 5:02 PM, Negin Nickparsa wrote:

> curtis what do you mean --c?
>
>
> On Fri, Feb 17, 2012 at 4:54 PM, Curtis Maurand wrote:
>
>>
>> "C:\/Program\ Files\\..."
>>
>> --C
>>
>>
>> Negin Nickparsa wrote:
>> > I can't move Gams because it has many dll files which should be in
>> there.
>> > gams.exe should be execute in that path file in program Files
>> > one time I tried to do it and when It shows me missing files I copy
>> pasted
>> > many files but It needs many other files which I regretted so it is not
>> > possible.
>> > I tried \\\
>> >
>> > string(101) "'C:/Program\\' is not recognized as an internal or external
>> > command, operable program or batch file. "
>> >
>> > On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:
>> >
>> >> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>> >>
>> >> this one:
>> >> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
>> >> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>> >>
>> >> GENERATES:
>> >>
>> >> string(100) "'C:/Program\' is not recognized as an internal or external
>> >> command, operable program or batch file. "
>> >>
>> >>>
>> >> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out
>> >> of
>> >> Program Files and into a directory without spaces!
>> >>
>> >> Change the \\ in the commands to just a single \ but leave the space
>> >> after
>> >>> it.
>> >>>
>> >>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa
>> >>> wrote:
>> >>>
>>  ok sorry,I tried yours It generates Null.
>> 
>> 
>>  On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas 
>>  wrote:
>> 
>> > Please quote the relevant parts of the email you're replying to -
>> > your
>> > emails have massively diminished usefulness to the archives.
>> >
>> > On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>> >
>> > It generates NULL
>> >
>> >
>> > My bad, try this…
>>
>> >
>> > $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>> > '.escapeshellarg('C:/Program
>> > Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>> >
>> > If that still doesn't seem to work, I suggest you try just executing
>> > the command without arguments…
>>
>> >
>> > $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>> >
>> > Backticks execute a command and return the output:
>> > http://php.net/language.operators.execution
>> >
>> 
>> >> -Stuart
>> >>
>> >> --
>> >> Stuart Dallas
>> >> 3ft9 Ltd
>> >> http://3ft9.com/
>> >>
>> >
>>
>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
curtis what do you mean --c?

On Fri, Feb 17, 2012 at 4:54 PM, Curtis Maurand  wrote:

>
> "C:\/Program\ Files\\..."
>
> --C
>
>
> Negin Nickparsa wrote:
> > I can't move Gams because it has many dll files which should be in there.
> > gams.exe should be execute in that path file in program Files
> > one time I tried to do it and when It shows me missing files I copy
> pasted
> > many files but It needs many other files which I regretted so it is not
> > possible.
> > I tried \\\
> >
> > string(101) "'C:/Program\\' is not recognized as an internal or external
> > command, operable program or batch file. "
> >
> > On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:
> >
> >> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
> >>
> >> this one:
> >> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
> >> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
> >>
> >> GENERATES:
> >>
> >> string(100) "'C:/Program\' is not recognized as an internal or external
> >> command, operable program or batch file. "
> >>
> >>>
> >> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out
> >> of
> >> Program Files and into a directory without spaces!
> >>
> >> Change the \\ in the commands to just a single \ but leave the space
> >> after
> >>> it.
> >>>
> >>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa
> >>> wrote:
> >>>
>  ok sorry,I tried yours It generates Null.
> 
> 
>  On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas 
>  wrote:
> 
> > Please quote the relevant parts of the email you're replying to -
> > your
> > emails have massively diminished usefulness to the archives.
> >
> > On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
> >
> > It generates NULL
> >
> >
> > My bad, try this…
>
> >
> > $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
> > '.escapeshellarg('C:/Program
> > Files/GAMS23.7/trnsport_php.gms').' 2>&1';
> >
> > If that still doesn't seem to work, I suggest you try just executing
> > the command without arguments…
>
> >
> > $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
> >
> > Backticks execute a command and return the output:
> > http://php.net/language.operators.execution
> >
> 
> >> -Stuart
> >>
> >> --
> >> Stuart Dallas
> >> 3ft9 Ltd
> >> http://3ft9.com/
> >>
> >
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Curtis Maurand



"C:\/Program\ Files\\..."

--C

Negin
Nickparsa wrote:
> I can't move Gams because it has many dll files
which should be in there.
> gams.exe should be execute in that
path file in program Files
> one time I tried to do it and when It
shows me missing files I copy pasted
> many files but It needs
many other files which I regretted so it is not
> possible.
> I tried \\\
> 
> string(101) "'C:/Program\\'
is not recognized as an internal or external
> command, operable
program or batch file. "
> 
> On Fri, Feb 17, 2012 at
4:25 PM, Stuart Dallas  wrote:
> 
>> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>>
>> this one:
>> $cmd = 'C:/Program\
Files/GAMS23.7/gams.exe'.'
>> '.escapeshellarg('C:/Program
Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>
>> GENERATES:
>>
>> string(100)
"'C:/Program\' is not recognized as an internal or external
>> command, operable program or batch file. "
>>
>>>
>> Ok, in that case try \\\
instead of \. Alternatively move GAMS23.7 out
>> of
>> Program Files and into a directory without spaces!
>>
>> Change the \\ in the commands to just a single \
but leave the space
>> after
>>> it.
>>>
>>> On Fri, Feb 17, 2012 at 4:10 PM, Negin
Nickparsa
>>> wrote:
>>>
 ok sorry,I tried yours It generates
Null.


 On
Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas 
 wrote:

>
Please quote the relevant parts of the email you're replying to -
> your
> emails have
massively diminished usefulness to the archives.
>
> On 17 Feb 2012, at 12:21,
Negin Nickparsa wrote:
>
>
It generates NULL
>
>
> My bad, try this…
>
> $cmd = 'C:/Program\\
Files/GAMS23.7/gams.exe'.'
>
'.escapeshellarg('C:/Program
>
Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>
> If that still doesn't
seem to work, I suggest you try just executing
>
the command without arguments…
>
> $cmd = 'C:/Program\\
Files/GAMS23.7/gams.exe 2>&1';
>
> Backticks execute a command and return the
output:
>
http://php.net/language.operators.execution
>

>> -Stuart
>>
>> --
>> Stuart Dallas
>> 3ft9 Ltd
>>
http://3ft9.com/
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
$cmd = system ("\"C:\\Program Files\\GAMS23.7\\gams.exe\"
trnsport_php.gms");
$out = `$cmd`;
var_dump($out);

It shows NULL

On Fri, Feb 17, 2012 at 4:38 PM, Negin Nickparsa wrote:

> and this One
> system ("\"c:\\program files\\myapp\\myapp.exe\" params_for_myapp");
>
>
> On Fri, Feb 17, 2012 at 4:36 PM, Negin Nickparsa wrote:
>
>> I read about
>>
>> The useless command may be like "c:" or "cd".
>>
>> Example:
>>
>> system('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>>
>> exec('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>>
>> in php manual But I didn't know how to work with it
>> It doesn't use any back slashes
>>
>> On Fri, Feb 17, 2012 at 4:29 PM, Negin Nickparsa wrote:
>>
>>> I can't move Gams because it has many dll files which should be in there.
>>> gams.exe should be execute in that path file in program Files
>>> one time I tried to do it and when It shows me missing files I copy
>>> pasted many files but It needs many other files which I regretted so it is
>>> not possible.
>>> I tried \\\
>>>
>>> string(101) "'C:/Program\\' is not recognized as an internal or external
>>> command, operable program or batch file. "
>>>
>>> On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:
>>>
 On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:

 this one:
 $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
 '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';

 GENERATES:

 string(100) "'C:/Program\' is not recognized as an internal or external
 command, operable program or batch file. "

>
 Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out
 of Program Files and into a directory without spaces!

 Change the \\ in the commands to just a single \ but leave the space
> after it.
>
> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa 
> wrote:
>
>> ok sorry,I tried yours It generates Null.
>>
>>
>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas wrote:
>>
>>> Please quote the relevant parts of the email you're replying to -
>>> your emails have massively diminished usefulness to the archives.
>>>
>>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>>
>>> It generates NULL
>>>
>>>
>>> My bad, try this…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>>> '.escapeshellarg('C:/Program
>>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>
>>> If that still doesn't seem to work, I suggest you try just executing
>>> the command without arguments…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>>
>>> Backticks execute a command and return the output:
>>> http://php.net/language.operators.execution
>>>
>>
 -Stuart

 --
 Stuart Dallas
 3ft9 Ltd
 http://3ft9.com/

>>>
>>>
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
and this One
system ("\"c:\\program files\\myapp\\myapp.exe\" params_for_myapp");

On Fri, Feb 17, 2012 at 4:36 PM, Negin Nickparsa wrote:

> I read about
>
> The useless command may be like "c:" or "cd".
>
> Example:
>
> system('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>
> exec('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');
>
> in php manual But I didn't know how to work with it
> It doesn't use any back slashes
>
> On Fri, Feb 17, 2012 at 4:29 PM, Negin Nickparsa wrote:
>
>> I can't move Gams because it has many dll files which should be in there.
>> gams.exe should be execute in that path file in program Files
>> one time I tried to do it and when It shows me missing files I copy
>> pasted many files but It needs many other files which I regretted so it is
>> not possible.
>> I tried \\\
>>
>> string(101) "'C:/Program\\' is not recognized as an internal or external
>> command, operable program or batch file. "
>>
>> On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:
>>
>>> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>>>
>>> this one:
>>> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
>>> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>
>>> GENERATES:
>>>
>>> string(100) "'C:/Program\' is not recognized as an internal or external
>>> command, operable program or batch file. "
>>>

>>> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out
>>> of Program Files and into a directory without spaces!
>>>
>>> Change the \\ in the commands to just a single \ but leave the space
 after it.

 On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa 
 wrote:

> ok sorry,I tried yours It generates Null.
>
>
> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas wrote:
>
>> Please quote the relevant parts of the email you're replying to -
>> your emails have massively diminished usefulness to the archives.
>>
>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>
>> It generates NULL
>>
>>
>> My bad, try this…
>>
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>> '.escapeshellarg('C:/Program
>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>
>> If that still doesn't seem to work, I suggest you try just executing
>> the command without arguments…
>>
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>
>> Backticks execute a command and return the output:
>> http://php.net/language.operators.execution
>>
>
>>> -Stuart
>>>
>>> --
>>> Stuart Dallas
>>> 3ft9 Ltd
>>> http://3ft9.com/
>>>
>>
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I read about

The useless command may be like "c:" or "cd".

Example:

system('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');

exec('c: & "C:\Program Files\..." "parameter 1" "parameter 2"');

in php manual But I didn't know how to work with it
It doesn't use any back slashes
On Fri, Feb 17, 2012 at 4:29 PM, Negin Nickparsa wrote:

> I can't move Gams because it has many dll files which should be in there.
> gams.exe should be execute in that path file in program Files
> one time I tried to do it and when It shows me missing files I copy pasted
> many files but It needs many other files which I regretted so it is not
> possible.
> I tried \\\
>
> string(101) "'C:/Program\\' is not recognized as an internal or external
> command, operable program or batch file. "
>
> On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:
>
>> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>>
>> this one:
>> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
>> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>
>> GENERATES:
>>
>> string(100) "'C:/Program\' is not recognized as an internal or external
>> command, operable program or batch file. "
>>
>>>
>> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out of
>> Program Files and into a directory without spaces!
>>
>> Change the \\ in the commands to just a single \ but leave the space
>>> after it.
>>>
>>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa wrote:
>>>
 ok sorry,I tried yours It generates Null.


 On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:

> Please quote the relevant parts of the email you're replying to - your
> emails have massively diminished usefulness to the archives.
>
> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>
> It generates NULL
>
>
> My bad, try this…
>
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
> '.escapeshellarg('C:/Program
> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>
> If that still doesn't seem to work, I suggest you try just executing
> the command without arguments…
>
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>
> Backticks execute a command and return the output:
> http://php.net/language.operators.execution
>

>> -Stuart
>>
>> --
>> Stuart Dallas
>> 3ft9 Ltd
>> http://3ft9.com/
>>
>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I can't move Gams because it has many dll files which should be in there.
gams.exe should be execute in that path file in program Files
one time I tried to do it and when It shows me missing files I copy pasted
many files but It needs many other files which I regretted so it is not
possible.
I tried \\\

string(101) "'C:/Program\\' is not recognized as an internal or external
command, operable program or batch file. "

On Fri, Feb 17, 2012 at 4:25 PM, Stuart Dallas  wrote:

> On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:
>
> this one:
> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.'
> '.escapeshellarg('C:/Program Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>
> GENERATES:
>
> string(100) "'C:/Program\' is not recognized as an internal or external
> command, operable program or batch file. "
>
>>
> Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out of
> Program Files and into a directory without spaces!
>
> Change the \\ in the commands to just a single \ but leave the space after
>> it.
>>
>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa wrote:
>>
>>> ok sorry,I tried yours It generates Null.
>>>
>>>
>>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
>>>
 Please quote the relevant parts of the email you're replying to - your
 emails have massively diminished usefulness to the archives.

 On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:

 It generates NULL


 My bad, try this…

 $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
 '.escapeshellarg('C:/Program
 Files/GAMS23.7/trnsport_php.gms').' 2>&1';

 If that still doesn't seem to work, I suggest you try just executing
 the command without arguments…

 $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';

 Backticks execute a command and return the output:
 http://php.net/language.operators.execution

>>>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Stuart Dallas
On 17 Feb 2012, at 12:53, Negin Nickparsa wrote:

> this one:
> $cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.' '.escapeshellarg('C:/Program 
> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
> 
> GENERATES:
> 
> string(100) "'C:/Program\' is not recognized as an internal or external 
> command, operable program or batch file. "

Ok, in that case try \\\ instead of \. Alternatively move GAMS23.7 out of 
Program Files and into a directory without spaces!

> Change the \\ in the commands to just a single \ but leave the space after it.
> 
>> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa  wrote:
>> ok sorry,I tried yours It generates Null.
>> 
>> 
>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
>> Please quote the relevant parts of the email you're replying to - your 
>> emails have massively diminished usefulness to the archives.
>> 
>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>> 
>>> It generates NULL
>> 
>> 
>> My bad, try this…
>> 
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.' '.escapeshellarg('C:/Program
>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>> 
>> If that still doesn't seem to work, I suggest you try just executing the 
>> command without arguments…
>> 
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>> 
>> Backticks execute a command and return the output: 
>> http://php.net/language.operators.execution

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
this one:
$cmd = 'C:/Program\ Files/GAMS23.7/gams.exe'.' '.escapeshellarg('C:/Program
Files/GAMS23.7/trnsport_php.gms').' 2>&1';

GENERATES:

string(100) "'C:/Program\' is not recognized as an internal or external
command, operable program or batch file. "

Change the \\ in the commands to just a single \ but leave the space after
> it.
>
> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa wrote:
>
>> ok sorry,I tried yours It generates Null.
>>
>>
>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
>>
>>> Please quote the relevant parts of the email you're replying to - your
>>> emails have massively diminished usefulness to the archives.
>>>
>>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>>
>>> It generates NULL
>>>
>>>
>>> My bad, try this…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>>> '.escapeshellarg('C:/Program
>>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>
>>> If that still doesn't seem to work, I suggest you try just executing the
>>> command without arguments…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>>
>>> Backticks execute a command and return the output:
>>> http://php.net/language.operators.execution
>>>
>>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Stuart Dallas
On 17 Feb 2012, at 12:42, Negin Nickparsa wrote:

> Oops no! it shows this one:
> string(100) "'C:/Program\' is not recognized as an internal or external 
> command, operable program or batch file. " 

Change the \\ in the commands to just a single \ but leave the space after it.

> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa  wrote:
> ok sorry,I tried yours It generates Null.
> 
> 
> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
> Please quote the relevant parts of the email you're replying to - your emails 
> have massively diminished usefulness to the archives.
> 
> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
> 
>> It generates NULL
> 
> 
> My bad, try this…
> 
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.' '.escapeshellarg('C:/Program
> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
> 
> If that still doesn't seem to work, I suggest you try just executing the 
> command without arguments…
> 
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
> 
> Backticks execute a command and return the output: 
> http://php.net/language.operators.execution

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Stuart I changed it to this one:$cmd = 'C:/Program\\Files/ Now it tells:
string(43) "The system cannot find the path specified. "

On Fri, Feb 17, 2012 at 4:12 PM, Negin Nickparsa wrote:

> Oops no! it shows this one:
> string(100) "'C:/Program\' is not recognized as an internal or external
> command, operable program or batch file. "
>
> On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa wrote:
>
>> ok sorry,I tried yours It generates Null.
>>
>>
>> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
>>
>>> Please quote the relevant parts of the email you're replying to - your
>>> emails have massively diminished usefulness to the archives.
>>>
>>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>>
>>> It generates NULL
>>>
>>>
>>> My bad, try this…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>>> '.escapeshellarg('C:/Program
>>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>>
>>> If that still doesn't seem to work, I suggest you try just executing the
>>> command without arguments…
>>>
>>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>>
>>> Backticks execute a command and return the output:
>>> http://php.net/language.operators.execution
>>>
>>> -Stuart
>>>
>>> --
>>> Stuart Dallas
>>> 3ft9 Ltd
>>> http://3ft9.com/
>>>
>>>
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Oops no! it shows this one:
string(100) "'C:/Program\' is not recognized as an internal or external
command, operable program or batch file. "

On Fri, Feb 17, 2012 at 4:10 PM, Negin Nickparsa wrote:

> ok sorry,I tried yours It generates Null.
>
>
> On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:
>
>> Please quote the relevant parts of the email you're replying to - your
>> emails have massively diminished usefulness to the archives.
>>
>> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>>
>> It generates NULL
>>
>>
>> My bad, try this…
>>
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
>> '.escapeshellarg('C:/Program
>> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>>
>> If that still doesn't seem to work, I suggest you try just executing the
>> command without arguments…
>>
>> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>>
>> Backticks execute a command and return the output:
>> http://php.net/language.operators.execution
>>
>> -Stuart
>>
>> --
>> Stuart Dallas
>> 3ft9 Ltd
>> http://3ft9.com/
>>
>>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
ok sorry,I tried yours It generates Null.

On Fri, Feb 17, 2012 at 4:06 PM, Stuart Dallas  wrote:

> Please quote the relevant parts of the email you're replying to - your
> emails have massively diminished usefulness to the archives.
>
> On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:
>
> It generates NULL
>
>
> My bad, try this…
>
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.'
> '.escapeshellarg('C:/Program
> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
>
> If that still doesn't seem to work, I suggest you try just executing the
> command without arguments…
>
> $cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';
>
> Backticks execute a command and return the output:
> http://php.net/language.operators.execution
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/
>
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Stuart Dallas
Please quote the relevant parts of the email you're replying to - your emails 
have massively diminished usefulness to the archives.

On 17 Feb 2012, at 12:21, Negin Nickparsa wrote:

> It generates NULL


My bad, try this…

$cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe'.' '.escapeshellarg('C:/Program
Files/GAMS23.7/trnsport_php.gms').' 2>&1';

If that still doesn't seem to work, I suggest you try just executing the 
command without arguments…

$cmd = 'C:/Program\\ Files/GAMS23.7/gams.exe 2>&1';

Backticks execute a command and return the output: 
http://php.net/language.operators.execution

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
ow! Thanks I got Stuart meaning Now


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Fatih it shows this:
ERRORNULL
maybe program Files which has space should have something like \ which I
don't know ha?
or because of Null It is correct?


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Vikash Kumar
backtick operator (
http://www.php.net/manual/en/language.operators.execution.php) works like
shell_exec()

On 17 February 2012 18:00, Negin Nickparsa  wrote:

> stuart $out = `$cmd`; what it will do? what is `? I didn't ever seen it
>


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
stuart $out = `$cmd`; what it will do? what is `? I didn't ever seen it


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Duken how you use " and again another " without a dot?
I tried yours it says:

*Warning*: system() [function.system ]:
Cannot execute a blank command in *C:\Program
Files\GAMS23.7\calling_gams.php* on line *23*
Error


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Duken Marga
I think it's wrong:
system(' "C:/Program Files/GAMS23.7/gams.exe "C:/Program
Files/GAMS23.7/trnsport_php.gms'))

Instead, try this:
system(' "C:/Program Files/GAMS23.7/gams.exe" "C:/Program
Files/GAMS23.7/trnsport_php.gms" '))

It is a good practice to write full path because we don't know
behaviour any operating system we use when we just use simple name.


On Fri, Feb 17, 2012 at 7:12 PM, Negin Nickparsa  wrote:
> if (($out = system(' "C:/Program Files/GAMS23.7/gams.exe "C:/Program
> Files/GAMS23.7/trnsport_php.gms')) !== FALSE)
> {
>  print('Not error!');
>
>  printf('Output is "%s"', $out);
> }
> else
> {
>  print('Error');
> }
> Fatih it shows again nothing why I should set the full path even when I run
> my file on the path I don't think so that it is needed I don't know how to
> work with these quotations was it right Duken?



-- 
Duken Marga

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
Apache


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 2:19 PM, Stuart Dallas  wrote:

> On 17 Feb 2012, at 12:12, Negin Nickparsa wrote:
> > if (($out = system(' "C:/Program Files/GAMS23.7/gams.exe "C:/Program
> > Files/GAMS23.7/trnsport_php.gms')) !== FALSE)
> > {
> > print('Not error!');
> > printf('Output is "%s"', $out);
> > }
> > else
> > {
> > print('Error');
> > }
> > Fatih it shows again nothing why I should set the full path even when I
> run
> > my file on the path I don't think so that it is needed I don't know how
> to
> > work with these quotations was it right Duken?
>
>
> * Use back ticks to get the full output.
> * Use escapeshellcmd and escapeshellarg to ensure the command is built in
> a safe and valid way.
> * Redirect stderr to stdout using 2>&1 so you see any error messages that
> are being generated.
>
> $cmd = escapeshellcmd('C:/Program Files/GAMS23.7/gams.exe').'
> '.escapeshellarg('C:/Program
> Files/GAMS23.7/trnsport_php.gms').' 2>&1';
> $out = `$cmd`;
> var_dump($out);
>
> Try that, then you can build logic that checks the output for errors. You
> may also want to make sure that safe_mode is disabled, though I doubt
> that's the problem.
>
> -Stuart
>
> --
> Stuart Dallas
> 3ft9 Ltd
> http://3ft9.com/


it is espacing issue as Stuart stated.. try this one thats working for me
with spaces

//$out = shell_exec("\"C:/Program Files/tws_date.exe\""); tws_date is c
program prints date. nothing special
$out = shell_exec("\"C:/Program Files/GAMS23.7/gams.exe\" \"C:/Program
Files/GAMS23.7/trnsport_php.gms\"");

if ($out) {
echo "OK: " . $out;
} else {
echo "ERROR";
}

var_dump($out);


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I changed it to this one:
$out = $cmd;

now it shows

string(85) "C:/Program Files/GAMS23.7/gams.exe "C:/Program
Files/GAMS23.7/trnsport_php.gms" 2>&1"


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
It generates NULL


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Stuart Dallas
On 17 Feb 2012, at 12:12, Negin Nickparsa wrote:
> if (($out = system(' "C:/Program Files/GAMS23.7/gams.exe "C:/Program
> Files/GAMS23.7/trnsport_php.gms')) !== FALSE)
> {
> print('Not error!');
> printf('Output is "%s"', $out);
> }
> else
> {
> print('Error');
> }
> Fatih it shows again nothing why I should set the full path even when I run
> my file on the path I don't think so that it is needed I don't know how to
> work with these quotations was it right Duken?


* Use back ticks to get the full output.
* Use escapeshellcmd and escapeshellarg to ensure the command is built in a 
safe and valid way.
* Redirect stderr to stdout using 2>&1 so you see any error messages that are 
being generated.

$cmd = escapeshellcmd('C:/Program Files/GAMS23.7/gams.exe').' 
'.escapeshellarg('C:/Program
Files/GAMS23.7/trnsport_php.gms').' 2>&1';
$out = `$cmd`;
var_dump($out);

Try that, then you can build logic that checks the output for errors. You may 
also want to make sure that safe_mode is disabled, though I doubt that's the 
problem.

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/

Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
if (($out = system(' "C:/Program Files/GAMS23.7/gams.exe "C:/Program
Files/GAMS23.7/trnsport_php.gms')) !== FALSE)
{
 print('Not error!');
 printf('Output is "%s"', $out);
}
else
{
 print('Error');
}
Fatih it shows again nothing why I should set the full path even when I run
my file on the path I don't think so that it is needed I don't know how to
work with these quotations was it right Duken?


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
replace \ in path with /
then should work fine on windows too.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Duken Marga
Try to write full path to executable file and don't forget to bring
double quote to that path. It must because "Program files" contain
space and php think your program is "Program" that contain parameter
"files".

if(system(' "C:\Program Files\GAMS23.7\gams.exe" trnsport_php.gms')


On Fri, Feb 17, 2012 at 6:26 PM, Negin Nickparsa  wrote:
> I have a Gams 
> application
>  which I want to run it through php code after trying many things finally I
> found that for running in commmand line I should go to C:\Program
> Files\GAMS23.7 run a command in commandline for running the application as
> follows:
>
> gams.exe trnsport_php.gms
>
> the Gams wil be run successfully in commandline now I wanted to run it in
> php I added an alias with this path
>
> C:\Program Files\GAMS23.7
>
> and then I created my php file in there when I want to exacute it with this
> code in php:
>
> if(system('gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> it shows me Error
>
> and again using this one:
>
> if(system('./gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> has printed again Error
>
> I tried exec too but no result I don't know what is wrong here.
>
> I read the manual but I coudn't find what's wrong here
>
> echo system('dir')
>
> will show the files of   C:\Program Files\GAMS23.7



-- 
Duken Marga

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I don't know what is going here!? well it shows no error but the out put is
nothing and my gams when running should make a text file but by running,it
doesn't happen so It has problem


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
give the full path of trnsport_php.gms too.

shell_exec should be working fine on windows as well.


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
yes it prints nothing by this code

if (($out = system('C:\Program Files\GAMS23.7\gams.exe trnsport_php.gms'))
!== FALSE)
{
 print('Not error');
 printf('Output is "%s"', $out);
}
else
{
 print('Error');
}


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread ma...@behnke.biz


Negin Nickparsa  hat am 17. Februar 2012 um 12:26
geschrieben:

> if(system('gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> it shows me Error

system() Returns the last line of the command output on success, and FALSE
on failure.

So, lets assume your gams program does not fail but prints nothing, the
output is empty.
By simply checking

if (system(...))

you will get echo 'Error'; even if everything is fine, but nothing is
print. Try checking on FALSE

if (($out = system(...)) !== FALSE)
{
  print('Not error');
  printf('Output is "%s"', $out);
}
else
{
  print('Error');
}


Besides: I would prefer setting the complete path to your exe-file.

if (system('C:\\PATH\\TO\\MY\\gams.exe trnsport_php.gms'))

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Negin Nickparsa
I am in windows yeah I tried this one
  if(shell_exec('C:\Program Files\GAMS23.7\gams.exe trnsport_php.gms'))
  echo 'yes'  ;
  else echo 'no';
it wil show me no
my another try:

 if(shell_exec('cd C:\Program Files\GAMS23.7') )
echo 'yes';
else echo 'no';

it will show me No again I even can't run CD command why?


Re: [PHP] how to execute Exe file in system

2012-02-17 Thread Fatih P.
On Fri, Feb 17, 2012 at 1:26 PM, Negin Nickparsa wrote:

> I have a Gams application<
> http://interfaces.gams-software.com/doku.php?id=env%3aspawning_gams_from_php
> >
>  which I want to run it through php code after trying many things finally I
> found that for running in commmand line I should go to C:\Program
> Files\GAMS23.7 run a command in commandline for running the application as
> follows:
>
> gams.exe trnsport_php.gms
>
> the Gams wil be run successfully in commandline now I wanted to run it in
> php I added an alias with this path
>
> C:\Program Files\GAMS23.7
>
> and then I created my php file in there when I want to exacute it with this
> code in php:
>
> if(system('gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> it shows me Error
>
> and again using this one:
>
> if(system('./gams.exe trnsport_php.gms'))
> echo 'Not Error';
> else echo'Error';
>
> has printed again Error
>
> I tried exec too but no result I don't know what is wrong here.
>
> I read the manual but I coudn't find what's wrong here
>
> echo system('dir')
>
> will show the files of   C:\Program Files\GAMS23.7
>

have you tried using shell_exec with full path rather than including its
executation path?

$out = shell_exec('/var/www/myapp/run arg1 arg2');