PHPBuilder - Replacing Perl Scripts with PHP Scripts Page 2



RSS Twitter
Articles Tricks And Hacks

Replacing Perl Scripts with PHP Scripts - Page 2

by: Jayesh Jain
|
November 11, 2002

Getting Started

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.

<?php
   
echo "Hello World";
?>
Open your command prompt and change your directory to the folder where PHP is installed and run the following command:
php world.php
Php Hello World output
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).
X-Powered-By: PHP/4.2.3
Content-type: text/html
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
-q
(Quiet-mode,Suppress HTTP Header output.)

-w
(Display source with stripped comments and whitespace)

-v
(Version number)

-c <path>
(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)

-d
(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])

-l
(This option checks for the Syntax in the source file)

-i
(This command line option calls phpinfo() and prints out the results.)

« Previous Page
1
|
2
|
3
|
4
|
5
|
6
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Jayesh Jain

Comment:



Comment:

(Maximum characters: 1200). You have characters left.