CGI (c++) - Fork To PHP - _popen - 404 No input file specified

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

 



I am running IIS / 2000 server.

I have php api in place. Works
well.

I have a c++ program.

------------------------------------

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
printf("Content-Type: text/html\r\n\n");
printf("<html>");
printf("<body>");

FILE* whandle; // handle to one end of pipe
char message[256]; // buffer for text passed through pipe
int status; // function return value
whandle = _popen("c:\\php\\php.exe c:\\wwwroot\\test.php", "rt");
//whandle = _popen("ping www.motivateus.com", "rt");
if (whandle == NULL)
{
perror("_popen error");
}
printf("%s\n","here");
while (fgets(message, sizeof(message), whandle))
{
//fprinaltf(stdout, message);
printf("%s\n",message);
}

status = _pclose(whandle);
if (status == -1)
{
perror("_pclose error");
}
printf("</body>");
printf("</html>");
}

and a .php

<?php
echo "This is a test / only a test.";
?>

The program runs perfect from the command prompt.
When ran through the web server (browser). The
stdout was getting all screwed up.

Found this at MS sight, barried.


SUMMARY
When using the C-runtime routine _popen() to create a child process from
within a CGI process,
there are several issues regarding the mapping of STDIN and STDOUT (also
STDERR) handles.
By default Internet Information Server (IIS) 3.0 and 4.0 (5) will not create
a console when a
CGI process is created. The STDIN and STDOUT of the CGI process and that of
the child
process (created from the CGI process) will not be mapped correctly.

I don't think bill wants people to do this type of process. It totally opens
the possibilities.

http://support.microsoft.com/default.aspx?kbid=194948

Made the changes to the metabase. (CreateCGIWithNewConsole property)

Cool, this took care of the io problem.

The server no long hangs.

When I run the program with a ping everyhing
works perfect.

But when I run it with the php fork in. I get the following

Status: 404
Content-type: text/html
X-Powered-By: PHP/4.3.2
No input file specified.

The "test.php" argument is not getting there.

It makes no sense why it won't work.

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


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux