Re: [PHP] How to give parameters to a console php-script?

2003-01-02 Thread David Yee
Martin- the command line switches are stored  in the $_SERVER['argv'] array.
E.g.

php -q myscript.php4 1000

The value of $_SERVER['argv'][1] in the myscript.php4 script would be 1000.

David

- Original Message -
From: Martin Thoma [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 02, 2002 5:40 AM
Subject: [PHP] How to give parameters to a console php-script?


 Hello!

 I start a console app with

 php myscript.php4 (just prints ok).

 How can I give parameters to it? I tried:
 php myscript.php4 myparameter
 php myscript.php4?myparameter
 php myscript.php4?param=myparameter

 But always php just returns without doing nothing (not even giving an
 error or printing Ok!) I'm using PHP 4.2.3. on Windows2000).

 Martin



 --
 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




[PHP] How to give parameters to a console php-script?

2002-12-02 Thread Martin Thoma
Hello!

I start a console app with

php myscript.php4 (just prints ok).

How can I give parameters to it? I tried:
php myscript.php4 myparameter
php myscript.php4?myparameter
php myscript.php4?param=myparameter

But always php just returns without doing nothing (not even giving an
error or printing Ok!) I'm using PHP 4.2.3. on Windows2000).

Martin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How to give parameters to a console php-script?

2002-12-02 Thread DL Neil
Hello Martin,

 I start a console app with
 
 php myscript.php4 (just prints ok).
 
 How can I give parameters to it? I tried:
 php myscript.php4 myparameter
 php myscript.php4?myparameter
 php myscript.php4?param=myparameter
 
 But always php just returns without doing nothing (not even giving an
 error or printing Ok!) I'm using PHP 4.2.3. on Windows2000).


I'm using the same version/platform and things work fine (for me).

Manual: Chapter 23. Using PHP from the command line 

You are correct the first time.

What do argv and argc tell you?
Is the php.ini file set up so that these variables are shown/valid?

Regards,
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How to give parameters to a console php-script?

2002-12-02 Thread Martin Thoma
Hi,

 What do argv and argc tell you?
 Is the php.ini file set up so that these variables are shown/valid?

Undefined variable:  argv - so I guess this is the problem ;-) What do I
have to change in the php.ini?

Martin


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How to give parameters to a console php-script?

2002-12-02 Thread Martin Thoma
ll I found a
register_argc_argv = On

in my php.ini, which should work then. But I also found, that I have to use

print Ok: .$_SERVER[argv][1];

instead of
print Ok: .$argv[1];

Martin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] How to give parameters to a console php-script?

2002-12-02 Thread DL Neil
Martin,
Ah yes, the famous 'read the upgrade notes - gotcha'!
Well done, you figured it out...
=dn


 ll I found a
 register_argc_argv = On

 in my php.ini, which should work then. But I also found, that I have to
use

 print Ok: .$_SERVER[argv][1];

 instead of
 print Ok: .$argv[1];

 Martin



 --
 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




Re: [PHP] How to give parameters to a console php-script?

2002-12-02 Thread Martin Thoma
 Martin,
 Ah yes, the famous 'read the upgrade notes - gotcha'!
 Well done, you figured it out...
 =dn

Thanx for your help, it pointed me in the right direction ;-)



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php