Hello, PHP(CLI) World!
Posted on 12月 19th, 2011 by cx20
PHP
PHP は Web アプリケーションのサーバーサイドに特化したスクリプト言語である。
名前の由来は「Personal Home Page」から。現在は「PHP is Hypertext Pre-processer」の略とされている。
PHP の実行方式としては、サーバーモジュール方式(mod_php, ISAPI)、CGI 方式、CLI 方式などがある。
CLI 方式の場合は HTTP ヘッダ “Content-Type: text/html¥n¥n” が出力されず通常のコマンドラインアプリケーションとしての動作をする。
ソースコード
実行方法(スクリプトファイルを指定して実行)
$ php hello.php |
実行方法(実行権限を付与して実行)
$ chmod +x hello.php $ ./hello.php |
実行結果(CLI版として実行)
Hello, PHP World! |
実行結果(CGI版として実行)
X-Powered-By: PHP/5.3.6 Content-type: text/html Hello, PHP World! |
Tags: PHP
Categories: PHP