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 nickpa...@gmail.comwrote: 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

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

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

2012-02-17 Thread ma...@behnke.biz
Negin Nickparsa nickpa...@gmail.com 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

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

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

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

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

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 stu...@3ft9.com 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);

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

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 http://localhost/gams/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 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 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 nickpa...@gmail.com 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
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 Negin Nickparsa
ow! Thanks I got Stuart meaning Now

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

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 stu...@3ft9.com 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:

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 nickpa...@gmail.comwrote: ok sorry,I tried yours It generates Null. On Fri, Feb 17, 2012 at 4:06 PM,

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 nickpa...@gmail.comwrote: Oops no! it shows this one: string(100) 'C:/Program\' is not recognized as an internal

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

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').' 21'; 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

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').' 21'; GENERATES: string(100) 'C:/Program\' is not recognized as an internal or external command, operable program

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

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

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 nickpa...@gmail.comwrote: I read about The useless command may be like c: or cd. Example: system('c: C:\Program Files\... parameter 1 parameter 2'); exec('c:

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 nickpa...@gmail.comwrote: and this One system (\c:\\program files\\myapp\\myapp.exe\ params_for_myapp); On Fri, Feb 17,

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

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 cur...@maurand.com 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

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

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

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 nickpa...@gmail.comwrote: 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

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 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 nickpa...@gmail.comwrote: Fatih what is about another parts?

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
:) On Fri, Feb 17, 2012 at 5:27 PM, Fatih P. fatihpirist...@gmail.com 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').' 21'; $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

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