[PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
I am unable to execute my c++ program from within PHP when it runs as a
cgi in Apache. 
I am able to run:

$cmd="dir c:\abc"
system ($cmd, $errCode);

and see the content of the directory, but I don't seem to
be able to run a simple hello.exe (c++) file.

$cmd = "c:\abc\hello.exe";
system ($cmd, $errCode);

The errCode always comes back with 128. What does 128 mean?
 
Here is some info on my setup.
OS: Windows XP
Server: Apache 2.0.43 (win32)
PHP 4.2.3
I am running PHP as a CGI

I am able to execute my c++ program (hello.exe) from this .php file 
just fine if I use the PHP cli.
 
I appreciate any help.


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




Re: [PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
I have tried escaping with backslashes and also tried
forward slashes with no luck. I believe my path
specification is correct because I can look at
different directories. 
$cmd = "dir c:\abc\efg";
system ($cmd, $errCode);
Correctly display the content of "efg", and the 
errCode is 0;

I think the key to my problem is the return_var
(errCode) of 128. (That is what I get in errCode when
I try to execute hello.exe)

Do you know where the return_var(s) for php 
(exec, system, ...) are defined?

Is there something in php.ini that have to be set up
inorder to be able to execute a file on the server?

I have looked at php.net but had no luck.

Thanks for your suggestions.

"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in
message news:3DCBCF6B.905@;webglobe.sk...
> escape your backslashes:
> 
> $cmd = "c:\\abc\\hello.exe";
> 
> 
> 
> Ladan Pickering wrote:
> 
> >I am unable to execute my c++ program from within
PHP when it runs as a
> >cgi in Apache. 
> >I am able to run:
> >
> >$cmd="dir c:\abc"
> >system ($cmd, $errCode);
> >
> >and see the content of the directory, but I don't
seem to
> >be able to run a simple hello.exe (c++) file.
> >
> >$cmd = "c:\abc\hello.exe";
> >system ($cmd, $errCode);
> >
> >The errCode always comes back with 128. What does
128 mean?
> > 
> >Here is some info on my setup.
> >OS: Windows XP
> >Server: Apache 2.0.43 (win32)
> >PHP 4.2.3
> >I am running PHP as a CGI
> >
> >I am able to execute my c++ program (hello.exe)
from this .php file 
> >just fine if I use the PHP cli.
> > 
> >I appreciate any help.
> >
> >
> >  
> >
> 

__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




Re: [PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
Very good question Mike. 
In my hello.cc file, I have a cout to the stdout and
I open a file and write a couple of lines to it. The
reason I believe it is not running is that when 
the .php file is running from the cli, I see my
"cout" and the file (test.txt) that I open is created
and my lines are written to it. When I run the same
.php file from within my browser, the cout is not
displayed and the file (test.txt) is not created.

I am new to Windows, do you see something that I am 
not doing correctly?

Thanks

My question is how do you know it's not running?  If
it really is a "hello
world" application, where do you want the output to
go? To the browser?
That's pretty involved.  Try making it write to a file
and see if it
contains any output after execution.

Mike



"Ernest E Vogelsinger" <[EMAIL PROTECTED]> wrote
in message
news:5.1.1.6.2.20021108155320.03285f28@;mail.vogelsinger.at...
> At 15:30 08.11.2002, Ladan Pickering spoke out and
said:
> [snip]
> >I am unable to execute my c++ program from within
PHP when it runs as a
> >cgi in Apache.
> >I am able to run:
> >
> >$cmd="dir c:\abc"
> >system ($cmd, $errCode);
> >
> >and see the content of the directory, but I don't
seem to
> >be able to run a simple hello.exe (c++) file.
> >
> >$cmd = "c:\abc\hello.exe";
> >system ($cmd, $errCode);
> [snip]
>
> I think you need to either escape the backslash
(like c:\\abc\\hello.exe),
> or simply use forward slashes (as c:/abc/hello.exe).
>
>
> --
>>O Ernest E. Vogelsinger
>(\) ICQ #13394035
> ^ http://www.vogelsinger.at/
>







__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




RE: [PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
When I look at the program (hello.exe) under cygwin.
I see that the "x" bit is set for all. As far as I can
tell anyone is permitted to execute this program.

Thanks for your suggestion.

--- "John W. Holmes" <[EMAIL PROTECTED]> wrote:
> I haven't been following this whole thread, but have
> you ruled out
> permissions problems? If you have NTFS, does
> whatever user PHP is
> running as have permission to run the program?
> 
> ---John Holmes...
> 
> > -Original Message-
> > From: Ladan Pickering
> [mailto:ladan_pickering@;yahoo.com]
> > Sent: Friday, November 08, 2002 3:11 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Unable to execute c++ .exe file
> from php
> > 
> > I have tried escaping with backslashes and also
> tried
> > forward slashes with no luck. I believe my path
> > specification is correct because I can look at
> > different directories.
> > $cmd = "dir c:\abc\efg";
> > system ($cmd, $errCode);
> > Correctly display the content of "efg", and the
> > errCode is 0;
> > 
> > I think the key to my problem is the return_var
> > (errCode) of 128. (That is what I get in errCode
> when
> > I try to execute hello.exe)
> > 
> > Do you know where the return_var(s) for php
> > (exec, system, ...) are defined?
> > 
> > Is there something in php.ini that have to be set
> up
> > inorder to be able to execute a file on the
> server?
> > 
> > I have looked at php.net but had no luck.
> > 
> > Thanks for your suggestions.
> > 
> > "Marek Kilimajer" <[EMAIL PROTECTED]> wrote in
> > message news:3DCBCF6B.905@;webglobe.sk...
> > > escape your backslashes:
> > >
> > > $cmd = "c:\\abc\\hello.exe";
> > >
> > >
> > >
> > > Ladan Pickering wrote:
> > >
> > > >I am unable to execute my c++ program from
> within
> > PHP when it runs as a
> > > >cgi in Apache.
> > > >I am able to run:
> > > >
> > > >$cmd="dir c:\abc"
> > > >system ($cmd, $errCode);
> > > >
> > > >and see the content of the directory, but I
> don't
> > seem to
> > > >be able to run a simple hello.exe (c++) file.
> > > >
> > > >$cmd = "c:\abc\hello.exe";
> > > >system ($cmd, $errCode);
> > > >
> > > >The errCode always comes back with 128. What
> does
> > 128 mean?
> > > >
> > > >Here is some info on my setup.
> > > >OS: Windows XP
> > > >Server: Apache 2.0.43 (win32)
> > > >PHP 4.2.3
> > > >I am running PHP as a CGI
> > > >
> > > >I am able to execute my c++ program (hello.exe)
> > from this .php file
> > > >just fine if I use the PHP cli.
> > > >
> > > >I appreciate any help.
> > > >
> > > >
> > > >
> > > >
> > >
> > 
> > __
> > Do you Yahoo!?
> > U2 on LAUNCH - Exclusive greatest hits videos
> > http://launch.yahoo.com/u2
> > 
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> 
> 
> 


__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




RE: [PHP] Unable to execute c++ .exe file from php

2002-11-08 Thread Ladan Pickering
Thanks Ernest for your suggestion.
I tried you idea with forward and backward slashes and
nothing seem
to change. I still see the return_var of 128. PHP is
trying to tell me what
the problem was, but I am unable to find what 128
means. Any idea as
where the the "return_var" for the "system" and "exec"
commands are defined?

Thanks

--- Ernest E Vogelsinger <[EMAIL PROTECTED]>
wrote:
> At 00:00 09.11.2002, Ladan Pickering said:
> [snip]
> >When I look at the program (hello.exe) under
> cygwin.
> >I see that the "x" bit is set for all. As far as I
> can
> >tell anyone is permitted to execute this program.
> [snip] 
> 
> Make your command like this
> 
> c:/abc/hello.exe 2>&1
> 
> to see if some error is given... might be a problem
> with environment space?
> 
> 
> -- 
>>O Ernest E. Vogelsinger
>(\)ICQ #13394035
> ^ http://www.vogelsinger.at/
> 
> 


__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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




Re: [PHP] Unable to execute c++ .exe file from php - Resolved

2002-11-08 Thread Ladan Pickering
Thanks all for taking the time to help me out. I 
finally got the problem resolved. It appears that PHP
was trying to use cygwin1.dll and could not find it.
I am not sure why; I didn't think I even need
cygwin to run php w/ Apache. Once I put a copy of
cygwin1.dll in my system32 directory, my c++
.exe file started running.

Hope this helps someone else. If someone knows why
PHP needs any cygwin dlls, I would be interested in
knowing the reason. 

"Ladan Pickering" <[EMAIL PROTECTED]> wrote in
message
news:20021109025418.61843.qmail@;web11708.mail.yahoo.com...
> Thanks Ernest for your suggestion.
> I tried you idea with forward and backward slashes
and
> nothing seem
> to change. I still see the return_var of 128. PHP is
> trying to tell me what
> the problem was, but I am unable to find what 128
> means. Any idea as
> where the the "return_var" for the "system" and
"exec"
> commands are defined?
> 
> Thanks
> 
> --- Ernest E Vogelsinger <[EMAIL PROTECTED]>
> wrote:
> > At 00:00 09.11.2002, Ladan Pickering said:
> > [snip]
> > >When I look at the program (hello.exe) under
> > cygwin.
> > >I see that the "x" bit is set for all. As far as
I
> > can
> > >tell anyone is permitted to execute this program.
> > [snip] 
> > 
> > Make your command like this
> > 
> > c:/abc/hello.exe 2>&1
> > 
> > to see if some error is given... might be a
problem
> > with environment space?
> > 
> > 


__
Do you Yahoo!?
U2 on LAUNCH - Exclusive greatest hits videos
http://launch.yahoo.com/u2

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