Lets start with a small script (the most familiar one) to display "Hello World", create a text file "world.php" with the following text in your PHP folder.
echo "Hello World";
Open your command prompt and change your directory to the folder where PHP is installed and run the following command:
Surprised to see the output in the command prompt, rather than in the Web browser? Welcome to the other dimension of PHP! Also, you must have noticed that the following header is in the output (PHP does that by default, which also tells you the PHP version).
To suppress this HTTP header we could run PHP with the following command line parameter.
php -q world.php
Lets look at few of the command line options available with the PHP interpreter
(Quiet-mode,Suppress HTTP Header output.)
(Display source with stripped comments and
(With this option one can either specify a
directory where to look for php.ini or you can
specify a custom INI file directly (which does
not need to be named php.ini)
(This option allows to set a custom value for any of
the configuration directives allowed in php.ini. The
syntax is: -d configuration_directive[=value])
(This option checks for the Syntax in the source file)
(This command line option calls phpinfo() and prints
out the results.)