Re: calling php from perl
| From: | Chris Carbaugh | Date: | Mon, 18 Dec 2000 21:41:49 +0000 |
| Subject: | Re: calling php from perl | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30934@lists.php.net to get a copy of this message | ||
Have you tried putting "#!/usr/local/bin/php -q" at the top of your php
script?
Then just exec() your script:
/home/httpd/cgi-bin/test.php
I'm not too familiar with perl, but a different approach sometimes
helps.
Chris
On Mon, 18 Dec 2000, peter beardsley wrote:
> Date: Mon, 18 Dec 2000 16:14:26 +0000
> To: php-general@lists.php.net
> From: peter beardsley <pbeardsley@appropriatesolutions.com>
> Subject: [PHP] calling php from perl
>
> Hi,
> What I'm trying to accomplish is including the output of a php script
> in a
> perl CGI. The output of a perl/mod_perl CGI is not parsed by php, so
> I
> tried calling the php executable and printing the output, ala:
>
> #!/usr/bin/perl
>
> ## note: backticks in perl execute a command and returns stdout.
> print /usr/local/bin/php -f /home/httpd/cgi-bin/test.php;
>
> The contents of the test.php file is a simple:
>
> <?php print "hello world.\n" ?>
>
> What happens is PHP is smart enough to know that it's being called in
> a CGI
> context, and I get the following output in a browser:
>
> X-Powered-By: PHP/4.0.3pl1 Content-type: text/html No input file
> specified.
>
> If I run the perl script from the command line, it works fine. It's
> weird
> because I'm definitely specifying an input file with the "-f". I've
> tried
> many variations on this in perl including system(), various pipe and
> temp
> file hacks to no avail. I've poked around in the sources a bit and I
> think
> what's happening is that php is looking for a CGI parameter to
> specify an
> input file, and it's not there.
>
> Does anyone know how to work around this or an entirely different
> approach
> altogether?
>
> Thanks,
>
> Peter Beardsley
> Appropriate Solutions Inc.
> pbeardsley@appropriatesolutions.com
> (603)924-6079
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>