|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-24 09:33 UTC] edink@php.net
[2002-07-25 03:14 UTC] s dot lemke at infoworxx dot de
[2002-07-25 04:29 UTC] derick@php.net
[2002-07-25 16:31 UTC] s dot lemke at infoworxx dot de
[2002-07-25 20:16 UTC] sniper@php.net
[2002-08-02 04:59 UTC] s dot lemke at infoworxx dot de
[2002-08-02 05:09 UTC] edink@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 09:00:02 2026 UTC |
Hello, I have a problem calling PHP from Perl and did not find anything about this problem in the web nor in the bug-database. I tried this: --- open(OUTPUTFILE, "| /usr/local/bin/php"); select(OUTPUTFILE); --producing my output with perl-- close(OUTPUTFILE); --- With other Unix-Programs like "cat" everything works fine. Sendmail also uses this syntax for getting input. I have provided a small sample with 4 cases; case 2 is the one, wich does not work. I hope, you can help me. Regards, Sebastian ---- sample.pl ---- #!/usr/bin/perl -w # Test-Script ###################### use strict; use warnings; my $isCGI++ if defined($ENV{'GATEWAY_INTERFACE'}) && $ENV{'GATEWAY_INTERFACE'}=~/CGI/; if ($isCGI) { use CGI qw(:standard); my $cgihandler = new CGI; use CGI::Carp qw(fatalsToBrowser); ### case 1 : only printing test and <? phpinfo(); ?> # print "Content-type: text/html\n\n"; # print "test\n"; # print "<? phpinfo(); ?>\n"; # exit; ### case 2: PHP after PERL try # Error Message returning: "No input file specified." my $acthandle=select(); open(OUTPUTFILE, "| /usr/local/bin/php"); select(OUTPUTFILE); print "Content-type: text/html\n\n"; print "test\n"; print "<? phpinfo(); ?>\n"; close(OUTPUTFILE); select($acthandle); exit; ### case 3: same routine like calling php, ### but calling unix-command "cat" # works fine !!! # my $acthandle=select(); # open(OUTPUTFILE, "| /bin/cat"); # select(OUTPUTFILE); # print "Content-type: text/html\n\n"; # print "test\n"; # print "<? phpinfo(); ?>\n"; # close(OUTPUTFILE); # select($acthandle); # exit; ### case 4: calling php via "system" command ### works, but not optimal... # my $acthandle=select(); # open(OUTPUTFILE, "> /tmp/cms.temp"); # select(OUTPUTFILE); # print "Content-type: text/html\n\n"; # print "test\n"; # print "<? phpinfo(); ?>\n"; # close(OUTPUTFILE); # select($acthandle); # exec '/usr/local/bin/php', '/tmp/cms.temp'; # exit; } else { print "Demo using CGI.\n"; exit; } --- end ---