Discussion:
Calling PHP (cgi) from a perl script and passsing parameters
Jim Carey
2002-10-10 21:57:51 UTC
Permalink
Hi,

have been having problems passing parameters to a PHP script from a Perl script . I call the PHP script using (as an example):

$a=`/home/ozbcoz/http/testphp.php fred=testing`;
print "$a";


then I have a PHP script showing:

#!/usr/local/php/bin/php -q
<?

print "count=$argc<br>";
print "0=$argv[0]<br>";
print "1=$argv[1]<br>";
print "2=$argv[2]<br>";
phpinfo();
?>

the outout comes out as:

count=0
0=
1=
2=
plus the phpinfo bumpf - which shows argc as 0 and an empty array for argv

sny clues anyone ?

Jim Carey
Sascha Cunz
2002-10-10 23:27:44 UTC
Permalink
What you're referring is CLI, not CGI Version of PHP.

Anyway, i assume, you're using a PHP version 4.2 or higher.
Have a look at the $_SERVER['argc'] and $_SERVER['argv'].

Sascha
Post by Jim Carey
Hi,
have been having problems passing parameters to a PHP script from a Perl
$a=`/home/ozbcoz/http/testphp.php fred=testing`;
print "$a";
#!/usr/local/php/bin/php -q
<?
print "count=$argc<br>";
print "0=$argv[0]<br>";
print "1=$argv[1]<br>";
print "2=$argv[2]<br>";
phpinfo();
?>
count=0
0=
1=
2=
plus the phpinfo bumpf - which shows argc as 0 and an empty array for argv
sny clues anyone ?
Jim Carey
www.OZbcoz.com discount domain registration
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Carey
2002-10-10 23:33:52 UTC
Permalink
yes - am using 4.2.1

output from phpinfo() shows:

_SERVER["argv"] Array
(
)

_SERVER["argc"] 0

which agrees with the $argc and $argv output.

details on the build include:

Build Date Jul 18 2002 08:29:02
Configure Command './configure' '--prefix=/usr/local/php' '--with-config-file-path=/usr/local/bin/' '--enable-ftp' '--without-gd' '--with-mysql'
Server API CGI

the php.ini shows register_globals on and register_argc_argv on

works fine if I call the php mod directly from the command line - and parses the passed variable fine - just doesnt do it when called using the tick (or system function) from Perl


Jim Carey
www.OZbcoz.com discount domain registration
-----Original Message-----
Sent: Friday, 11 October 2002 9:28 AM
Subject: Re: [PHP] Calling PHP (cgi) from a perl script and passsing
parameters
What you're referring is CLI, not CGI Version of PHP.
Anyway, i assume, you're using a PHP version 4.2 or higher.
Have a look at the $_SERVER['argc'] and $_SERVER['argv'].
Sascha
Post by Jim Carey
Hi,
have been having problems passing parameters to a PHP script from a Perl
$a=`/home/ozbcoz/http/testphp.php fred=testing`;
print "$a";
#!/usr/local/php/bin/php -q
<?
print "count=$argc<br>";
print "0=$argv[0]<br>";
print "1=$argv[1]<br>";
print "2=$argv[2]<br>";
phpinfo();
?>
count=0
0=
1=
2=
plus the phpinfo bumpf - which shows argc as 0 and an empty
array for argv
Post by Jim Carey
sny clues anyone ?
Jim Carey
www.OZbcoz.com discount domain registration
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.ne
Jim Carey
2002-10-11 00:23:38 UTC
Permalink
sorry - seems my earlier post was base64 - apologies to all :-( - here it is
again


yes - am using 4.2.1

output from phpinfo() shows:

_SERVER["argv"] Array
(
)

_SERVER["argc"] 0

which agrees with the $argc and $argv output.

details on the build include:

Build Date Jul 18 2002 08:29:02
Configure Command './configure' '--prefix=/usr/local/php'
'--with-config-file-path=/usr/local/bin/' '--enable-ftp' '--without-gd'
'--with-mysql'
Server API CGI

the php.ini shows register_globals on and register_argc_argv on

works fine if I call the php mod directly from the command line - and parses
the passed variable fine - just doesnt do it when called using the tick (or
system function) from Perl


Jim Carey
www.OZbcoz.com discount domain registration
-----Original Message-----
Sent: Friday, 11 October 2002 9:28 AM
Subject: Re: [PHP] Calling PHP (cgi) from a perl script and passsing
parameters
What you're referring is CLI, not CGI Version of PHP.
Anyway, i assume, you're using a PHP version 4.2 or higher.
Have a look at the $_SERVER['argc'] and $_SERVER['argv'].
Sascha
Post by Jim Carey
Hi,
have been having problems passing parameters to a PHP script from a Perl
$a=`/home/ozbcoz/http/testphp.php fred=testing`;
print "$a";
#!/usr/local/php/bin/php -q
<?
print "count=$argc<br>";
print "0=$argv[0]<br>";
print "1=$argv[1]<br>";
print "2=$argv[2]<br>";
phpinfo();
?>
count=0
0=
1=
2=
plus the phpinfo bumpf - which shows argc as 0 and an empty
array for argv
Post by Jim Carey
sny clues anyone ?
Jim Carey
www.OZbcoz.com discount domain registration
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Loading...