Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

Replacing Perl Scripts with PHP Scripts
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.)
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
ThanksJeremy08/13/07 12:14
±â³×½ººÏ µµÀü, 100¹è »¡¶óÁö°í ½¬¿öÁø ¿µ¾î¿ø¸® ÀÌÈÆ±â11/16/05 00:54
Ä«/µå/ºú!ÀÌ·¸°Ô/ÇØ°áÇϼ¼¿ä±èÁø¼÷03/23/05 09:52
Ä«/µå/µ¹·Á¸·±â·Î/¸Á°¡Áö½ÅºÐ/²À º¸¼¼¿ä!ÀÌÇýÁø12/07/04 11:23
½Å.¿ë.ºÒ.·®.ÀÚ/´çÀÏ500/´ë.Ãâ.ºñ.¹ýÀÌÈñÁø12/06/04 02:33
Ä«,µå,¿¬,ü,ÀÚ/¿¹.Á¤.ÀÚ ´ë,Ãâ 100-1000¸¸¿øÀÌ´ÙÇö12/05/04 10:49
´ë'Ãâ'°Å'Àý'½Ã'100%µÇ'°Ô'ÇÏ'´Â'¹æ'¹ýÇѰæ¿í12/05/04 03:01
½Å.¿ë.ºÒ.·®/Ä«.µå.¿¬.ü/´ë.Ãâ/È¥ÀÚ/ÇØ.°áÇÏ´Â/¹æ.¹ý±èÇö¼­11/28/04 03:49
½Å.¿ë.ºÒ.·®.ÀÚ/´çÀÏ500/´ë.Ãâ.ºñ.¹ýÀÌÈñÁø11/27/04 23:24
´ë'Ãâ'°Å'Àý'½Ã'100%µÇ'°Ô'ÇÏ'´Â'¹æ'¹ýÇѰæ¹Î11/23/04 20:43
Ä«/µå/µ¹·Á¸·±â·Î/¸Á°¡Áö½ÅºÐ/²À º¸¼¼¿ä!ÀÌÁ¤¿¬11/18/04 20:52
Ä«.µå.±ø.¾È.ÇÏ.°í.µ·.¸¸.µé.¾î.¾².´Â.ºñ.¹ýÀÌÈñÁø11/15/04 12:57
Need HelpManoj Mitra11/13/04 05:15
php script to validate mobile number and emaivijay07/01/04 16:47
´ëÃâ °ÅÀý½Ã 100%µÇ°ÔÇÏ´Â ¹æ¹ý(Çʵ¶)!!!¼Û´ÙÈñ01/22/04 06:47
´ëÃâ °ÅÀý½Ã µÇ°Ô ÇÏ´Â ¹æ¹ý!!!¼­ÇöÈñ01/07/04 09:04
½Å¿ëºÒ·®/Ä«µå¿¬Ã¼/È¥ÀÚÇØ°áÇÏ´Â ¹æ¹ý!!(Çʵ¶) µµ¿ì¹Ì10/04/03 04:04
Can't start itMagnus Bergmark04/28/03 12:00
RE: But why?Clay Neudeck03/14/03 18:52
But why?J Hilton02/19/03 13:12
Important: CGI != CLI...philip olson12/16/02 13:59
RE: Can't reaplce Perl totallyTom12/13/02 11:02
RE: Daemon?Jason12/03/02 10:35
Daemon?Spot11/28/02 02:31
Some pointsKjartan Mannes11/26/02 09:40
RE: CLI new?Kjartan Mannes11/26/02 09:02
RE: Excutable PHP in Unix SystemJason11/25/02 09:10
Wondeful ArticleRaj Kambli11/22/02 17:47
RE: .exe incoming ;DJason11/21/02 10:08
Excutable PHP in Unix SystemAfif11/21/02 03:19
Seriously underrated use of PHPS Clark11/20/02 13:23
RE: Great articleDario Fumagalli11/19/02 10:14
RE: Great articleepplestun11/19/02 06:19
Very goodepplestun11/19/02 06:18
RE: Great articleepplestun11/19/02 06:05
.exe incoming ;DRipman11/18/02 16:33
ummm ....Anonymouse11/18/02 10:17
executableR. Vermeersch11/16/02 15:19
Can't reaplce Perl totallyBahwi11/15/02 15:52
RE: Great articleBDKR11/15/02 15:38
RE: Great articleJayesh Jain11/13/02 17:24
CLI new?Steve Werby11/13/02 17:04
Great articleN. Elsten11/12/02 11:09
 

If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.