php-windows Digest 6 Apr 2004 06:53:13 -0000 Issue 2196
Topics (messages 23365 through 23368):
CGI (c++) - Fork To PHP - _popen - 404 No input file specified
23365 by: Hankj
23366 by: DvDmanDT
Using PHP on Server 2003...
23367 by: Jason Boomer
23368 by: Svensson, B.A.T. (HKG)
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
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.
--- End Message ---
--- Begin Message ---
Hmm.. The filename isn't supposed to be passed as argument, I think, unless
you use like 4.3.6, which I think solves this.. I'm not sure at all
(guessing really), but it seems like you should write data to PHP's STDIN or
something.. Considering you are also able to pass POST, GET and server
specific variables, there has to be some kind of communication..
The easiest way to solve it would probably be to use the cli version...
--
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Hankj" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> 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.
--- End Message ---
--- Begin Message ---
I'm trying to setup PHP to run on Windows 2003 running IIS 6 and SQL Server
2000 SP2. I'm able to setup PHP itself with no problem; the "phpinfo.php"
page opens fine. The problem I have is when I try to setup either
"phpwebsite" or "phpbb". For some reason I continue to get a "Database not
found" error. I've verified everything with the database itself and it
works fine. I'm able to run a test query against the database with the user
I setup and I've also had a DB Admin friend of mine verify that the database
is setup correctly and it is. We even tried MySQL, and an Access DB but all
3 always return the same error when trying to configure either "phpwebsite",
or "phpbb".
Has anybody else run into this? Any help would be much appreciated. Thanks
a lot!
--- End Message ---
--- Begin Message ---
Just for the protocol:
You have made sure that the ms sql extension is available in the
php ini file, as well made sure that the ms sql dll is in the same directory
as php.exe?
-----Original Message-----
From: Jason Boomer
To: [EMAIL PROTECTED]
Sent: 2004-04-06 03:36
Subject: [PHP-WIN] Using PHP on Server 2003...
I'm trying to setup PHP to run on Windows 2003 running IIS 6 and SQL
Server 2000 SP2. I'm able to setup PHP itself with no problem; the
"phpinfo.php" page opens fine. The problem I have is when I try to setup
either "phpwebsite" or "phpbb". For some reason I continue to get a
"Database not found" error. I've verified everything with the database
itself and it works fine. I'm able to run a test query against the database
with the user I setup and I've also had a DB Admin friend of mine verify
that the database is setup correctly and it is. We even tried MySQL, and an
Access DB but all 3 always return the same error when trying to configure
either "phpwebsite", or "phpbb".
Has anybody else run into this? Any help would be much appreciated.
Thanks
a lot!
--- End Message ---