Calling PHP function from Perl - as external program
| From: | Vaclav Muchna | Date: | Thu, 07 Feb 2002 11:11:19 +0000 |
| Subject: | Calling PHP function from Perl - as external program | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-83828@lists.php.net to get a copy of this message | ||
Hi,
What i need 2 do is call some php script from perl code. I've whole site
written in Perl, and i'd like to use there adv. system written in PHP :-)
First i thought, that it will be easy. I've this codes:
*********************************
perl function get_banner():
system('/fullpath/ob', '100'); 100 means parametr, which
specifies category
// system runs its firts parametr, and passes the rest of list as
parametrs.
// i also tried do it trough
/fullpath/oa.php 100
*********************************
php file /fullpath/ob
#!/usr/bin/php -q
<?
echo "Params: $argv[0] - $argv[1]";
?>
of course, exec rights and standalone php are ok.
********************************
and only for test purposes i've also file oa
#!/bin/bash
echo $0 $1
------ that is start situation
in bash:
[neo@miesto lib]# ./oa bagr
./oa bagr
[neo@miesto lib]# ./ob bagr
Params: ./ob - bagr
so, it seem's everything works properly
when I call in perl this function:
system('/fullpath/oa', '100');
everything is ok
but, this
system('/fullpath/ob', '100');
produce this message:
X-Powered-By: PHP/4.1.0
Content-type: text/html
No input file specified.
but, when i remove -q parametr from ob, it procude this message:
X-Powered-By: PHP/4.1.0
Content-type: text/html
#! /usr/bin/php
Params:
so, it is executed, but seem to be parsed by some other php in system (due
to string output "#!/usr/bin/php"), but no parametrs are given.
If anybody has any idea, please help me ;-).
I have to note that i'm very beginner to the perl :-)
Thx
Vasek
PS. safemode is disabled.