argv and stdin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

w3cynic
Forum Newbie
Posts: 12
Joined: Sun Aug 11, 2002 11:06 am

Post by w3cynic »

I get "Could not open input file." which is what I expected, are you sure you are using -f option?

You pass arguments the same way as for any command so;

Code: Select all

php clitest.php -q with chesse
Would output;

Array
{
[0]=>clitest.php
[1]=>with
[2]=>cheese
}

None of which helps me:( Did you compile this yourself or was it pre-packaged for your distro?
daemorhedron
Forum Commoner
Posts: 52
Joined: Tue Jul 23, 2002 11:03 am

Post by daemorhedron »

I get "Could not open input file." which is what I expected, are you sure you are using -f option?
If you look at my original post and the test script, I was using -f originally, but another test without it yields the same results.

Code: Select all

#!/usr/local/bin/php 
<?php
        print_r($_SERVER&#1111;'argv']);
?>
[daemorhedron@obsidian daemorhedron]$ ./clitest.php spank me
Content-type: text/html

Array
(
[0] => ./clitest.php
[1] => spank
[2] => me
)
Did you compile this yourself or was it pre-packaged for your distro?
I compiled this myself.
None of which helps me:(
Maybe I am not understanding. I thought your problem is that you are not able to pass command line arguments to your script?
daemorhedron
Forum Commoner
Posts: 52
Joined: Tue Jul 23, 2002 11:03 am

Post by daemorhedron »

Not that it should matter at all, but here is my configure line for my cgi version of php on linux.

./configure --prefix=/usr/local --with-config-file-path=/usr/local/bin --enable-ftp --with-pgsql --enable-inline-optimization --with-pspell --with-mcrypt --with-mhash --enable-sockets --with-openssl --with-zlib --with-zlib-dir=/usr/local/lib

I know, it's massive, but there you go nonetheless.

HTH =)
Post Reply