I just began learning php. I\'ve installed php5
on linux and wrote very simple code just to get going.
How can I run scripts? I tried using the
As already mentioned, you can execute your PHP with the following.
$ php myScript.php
If you wish to pass an argument(s), you can simply do so like this:
$ php myScript.php Apples
In your PHP file you can use this argument by accessing the $argv array like this:
The above would print our "I like Apples". Note the array index is 1 and not 0. 0 is used for script name. In this case $argv would be "myScript.php"
For more info check out my blog post Running PHP from the Command Line - Basics