473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using exec function to get a .exe return status gives CGI Error

Hi.

I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).

As supposed, the HTTP headers are needed only if the executable prints
out a text to the browser but it's not the case. And (I repeat) It
worked as it before. The machine had to be formatted and the guy in
charge of that is not with me anymore.

Any help will be apreciated.

Aug 23 '07 #1
5 3314
jm****@ole.com wrote:
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).
Could you maybe post the relevant parts of your PHP script ?

Best regards,
Jan

--
__________________________________________________ _______________________
insOMnia - We never sleep...
http://www.insOMnia-hq.de
Aug 23 '07 #2
jm****@ole.com wrote:
Hi.

I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).

As supposed, the HTTP headers are needed only if the executable prints
out a text to the browser but it's not the case. And (I repeat) It
worked as it before. The machine had to be formatted and the guy in
charge of that is not with me anymore.

Any help will be apreciated.
What language is it written in? If it's something like C or C++, for
instance the libraries open stdout/stderr by default. It might be
causing your problem - but I doubt it.

More likely is that you're getting an error during the execution and the
system is trying to write something to stderr (or stdout). For
instance, you might not have the correct permissions to execute the file.

Try this:

1. Log onto the command line interface (ssh/telnet)
2. su to the webserver user
3. cd to the directory you're PHP script is in
4. Enter the command just as it is in the exec() call.

What happens?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 23 '07 #3

Thanks to both of you.

I write the PHP code

exec("myapp.exe ".$_POST["password"]." ". $cifrado[0]["PASSWORD"] ,
$output,$result);
echo $result;

if($result== 1)
{
....

The language is C++ but there is not printf or cout to generate any
text output. If I execute the command with cmd (I use Windows 2003
Server) the command is executed without problems (and no text output)
Aug 24 '07 #4
jm****@ole.com wrote:
Thanks to both of you.

I write the PHP code

exec("myapp.exe ".$_POST["password"]." ". $cifrado[0]["PASSWORD"] ,
$output,$result);
echo $result;

if($result== 1)
{
...

The language is C++ but there is not printf or cout to generate any
text output. If I execute the command with cmd (I use Windows 2003
Server) the command is executed without problems (and no text output)

It may not matter that there is no output. It opens stdout/cout, which
may be enough. I'm not sure on a Windows machine.

Also, headers are ALWAYS required. The browser makes a request, the
server MUST respond with headers, even if no data is sent (otherwise the
browser will time out).

But this should not affect script execution. What's the real message
you're getting (translated, please, as best you can - I don't so Spanish).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 24 '07 #5
jm****@ole.com wrote:
Thanks to both of you.

I write the PHP code

exec("myapp.exe ".$_POST["password"]." ". $cifrado[0]["PASSWORD"] ,
$output,$result);
echo $result;

if($result== 1)
{
...

The language is C++ but there is not printf or cout to generate any
text output. If I execute the command with cmd (I use Windows 2003
Server) the command is executed without problems (and no text output)

BTW - I still go back to a possible security issue. Does the webserver
user have permission to execute the C++ program?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Aug 24 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Thomas Mlynarczyk | last post by:
Hello! I run PHP 4.3 as an Apache module. I use Apache 1.3 as a service under WinXP. And I've got a strange problem with exec(): The following commands are executed correctly:...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
17
by: comp.lang.tcl | last post by:
The TCL command I am using will do a command-line action on a PHP script: set cannotRunPHP I have to do it this way as both the TCL script and the PHP script run as CLI. However, "info.php"...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
13
by: inetquestion | last post by:
I've narrowed the code to a problem with php/iplanet on linux. When I run the following code from the command line "$status" comes back as "0" as it should. However when I hit it with a browser,...
1
by: dvroman | last post by:
The procedure works without problems for the basic 'textbody' and 'htmlbody' type messages. The problem is I would like to get the CreateMHTMLBody method working. This works beautifully as a VBScript...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
0
by: kpoman | last post by:
Hi to all, I am trying to use some dll which needs some data types that I can't find in python. From the dll documentation, I am trying to use this: HRESULT IMKWsq::Compress ( VARIANT ...
0
by: Stef Mientki | last post by:
Terry Reedy wrote: sorry, don't know how this happened, as I always copy/paste ? AFAIK locals() == sys._getframe(0).f_locals AFAIK, again one level up weird, I use it in 2.5 and if I remember...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.