Bug #18537: calling php from perl only gives "No input file specified."
| From: | s dot lemke at infoworxx dot de | Date: | Wed, 24 Jul 2002 12:03:06 +0000 |
| Subject: | Bug #18537: calling php from perl only gives "No input file specified." | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-15038@lists.php.net to get a copy of this message | ||
From: s.lemke@infoworxx.de
Operating system: Suse Linux 7.3
PHP version: 4.2.2
PHP Bug Type: *General Issues
Bug description: calling php from perl only gives "No input file specified."
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 bug report at http://bugs.php.net/?id=18537&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18537&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18537&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18537&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18537&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18537&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18537&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18537&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18537&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18537&r=globals