954,557 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

popen2 problem

hi

I have a problem with this source code

#fi, fo = os.popen2('c:/python24/python.exe C:/AppServ/webserver/www/index.pyw')
            #fi, fo = os.popen2('c:/Perl/bin/perl.exe C:/AppServ/webserver/www/wwwp.pl')    
            fi, fo = os.popen2('c:/appserv/php/php.exe C:/AppServ/webserver/www/wphp.php')
            data = self.rfile.read(nbytes)
            fi.write(data)
            fi.close()
            shutil.copyfileobj(fo, self.wfile)
            sts = fo.close()

when I try with python or perl it works but with php not.

first it is

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

and when I edit php.ini with
cgi.force_redirect = 1

and then it is.....

No input file specified.

but in python make more errors when I make this with php
please help me

10x

peaceofmind
Newbie Poster
9 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

This is tough! I simply don't have enough information to help you.

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

it works with php5
10x:)

peaceofmind
Newbie Poster
9 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Any idea why it didn't work with other versions of php?

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

i don't know maybe the problem is in

http://bugs.php.net/bug.php?id=22127&edit=2

Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.


Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

... with this in php is ok byt in python no....
also
cgi.force_redirect = 1

peaceofmind
Newbie Poster
9 posts since Jul 2005
Reputation Points: 10
Solved Threads: 0
 

Interesting, thanks for your observations. I hope other programmers will benefit too!

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You