Bug #18537 Updated: calling php from perl only gives "No input file specified."

From: Date: Thu, 25 Jul 2002 08:29:24 +0000
Subject: Bug #18537 Updated: calling php from perl only gives "No input file specified."
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15134@lists.php.net to get a copy of this message
ID: 18537 Updated by: derick@php.net Reported By: s.lemke@infoworxx.de -Status: Open +Status: Feedback Bug Type: *General Issues Operating System: Suse Linux 7.3 PHP Version: 4.2.2 New Comment: You can alsways echo the headers out yourself: <?php echo "Content-type: text/html\r\n"; ?> Derick Previous Comments: ------------------------------------------------------------------------ [2002-07-25 03:14:51] s.lemke@infoworxx.de Hi, at first of all, thanks for your fast answer. I have tried it yesterday - calling php and processing the output of my perl script works when I am using the cli-feature - but as described in the manual the "Header" functions does not work. Therefore I need an cgi-version which is capable of being started in the described way. Is this possible or are there any other possiblities to get this running ? Regards, Sebastian ------------------------------------------------------------------------ [2002-07-24 09:33:49] edink@php.net That could be because php detects cgi env. variables present and tries to act accordingly. Could you try compiling php with --enable-cli and copy sapi/cli/php from you php build tree into /usr/local/bin/php? You can get more information about the differences between cgi and cli versions of php on http://www.php.net/manual/en/features.commandline.php ------------------------------------------------------------------------ [2002-07-24 08:03:04] s.lemke@infoworxx.de 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 --- ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18537&edit=1

« previous php.bugs (#15134) next »