|
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

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.)
| Comments: | ||
| Thanks | Jeremy | 08/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 Help | Manoj Mitra | 11/13/04 05:15 |
| php script to validate mobile number and emai | vijay | 07/01/04 16:47 |
| ´ëÃâ °ÅÀý½Ã 100%µÇ°ÔÇÏ´Â ¹æ¹ý(Çʵ¶)!!! | ¼Û´ÙÈñ | 01/22/04 06:47 |
| ´ëÃâ °ÅÀý½Ã µÇ°Ô ÇÏ´Â ¹æ¹ý!!! | ¼ÇöÈñ | 01/07/04 09:04 |
| ½Å¿ëºÒ·®/Ä«µå¿¬Ã¼/È¥ÀÚÇØ°áÇÏ´Â ¹æ¹ý!!(Çʵ¶) | µµ¿ì¹Ì | 10/04/03 04:04 |
| Can't start it | Magnus Bergmark | 04/28/03 12:00 |
| RE: But why? | Clay Neudeck | 03/14/03 18:52 |
| But why? | J Hilton | 02/19/03 13:12 |
| Important: CGI != CLI... | philip olson | 12/16/02 13:59 |
| RE: Can't reaplce Perl totally | Tom | 12/13/02 11:02 |
| RE: Daemon? | Jason | 12/03/02 10:35 |
| Daemon? | Spot | 11/28/02 02:31 |
| Some points | Kjartan Mannes | 11/26/02 09:40 |
| RE: CLI new? | Kjartan Mannes | 11/26/02 09:02 |
| RE: Excutable PHP in Unix System | Jason | 11/25/02 09:10 |
| Wondeful Article | Raj Kambli | 11/22/02 17:47 |
| RE: .exe incoming ;D | Jason | 11/21/02 10:08 |
| Excutable PHP in Unix System | Afif | 11/21/02 03:19 |
| Seriously underrated use of PHP | S Clark | 11/20/02 13:23 |
| RE: Great article | Dario Fumagalli | 11/19/02 10:14 |
| RE: Great article | epplestun | 11/19/02 06:19 |
| Very good | epplestun | 11/19/02 06:18 |
| RE: Great article | epplestun | 11/19/02 06:05 |
| .exe incoming ;D | Ripman | 11/18/02 16:33 |
| ummm .... | Anonymouse | 11/18/02 10:17 |
| executable | R. Vermeersch | 11/16/02 15:19 |
| Can't reaplce Perl totally | Bahwi | 11/15/02 15:52 |
| RE: Great article | BDKR | 11/15/02 15:38 |
| RE: Great article | Jayesh Jain | 11/13/02 17:24 |
| CLI new? | Steve Werby | 11/13/02 17:04 |
| Great article | N. Elsten | 11/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. | ||


