I had a system set up so that the CLI version of PHP could handle command line calls with arguments like this:

php wan2web.php p_site=www.foorbar.net p_user=johndoe p_pass=somepass p_path=/home/webs/foobar.net/html force=1

Now that I've moved to a new system (and PHP 5.0.1), I attempt to run the command above, the script acts as if no paramters are being seen.

Something is telling me that there is a line in the php.ini that I need to uncomment or write in (cuz I think I did it to the prior php.ini file).

Any help would be apprechiated.

TIA

    argv is completely empty? The = sign means nothing really to php. It just loads a numeric array in argv, so you should have

    Array (0 => wan2web.php 
           1 => p_site=www.foorbar.net 
           2 => p_user=johndoe 
           3 => p_pass=somepass 
           4 => p_path=/home/webs/foobar.net/html 
           5 => force=1 
    )

      No...that way is too structured and ridged....users would have to put in arguments in a specific way otherwise the script would mix up key/value pairs.

      The way I had it working was with the above command line. The code uses $_REQUEST['<argument_key_name>'] to pull the values. This way, the order of the values was not an issue.

      Nuts...I know that this works, I just didn't document it when I figured it out. Just goes to show how tech writers are at home.

      Maybe I was using the non-CLI PHP??? Nope, same result.

      There is a way that this can be done, I just forgot where I found the instructions for doing it (most likely here since this is my php mecca of sorts)

      If anyone knows, please let me know.

      TIA

        Where's what I'm seeing:

        PC #1: PHP 5.0.1 CGI or CLI = $_REQUEST empty

        PC #2: PHP 4.3.8 CGI = $_REQUEST filled

        I'm still comparing the php.ini files on the 2 machines but so far they look the same (minus changes to path entries).

        Is this something that has been changed between the versions?

        PHP's own website indicates that $_REQUEST be used to handle command line arguments.

        Any ideas???

          Write a Reply...