LoginSignup
2
1

More than 5 years have passed since last update.

[ PHP ] PHPビルトイン webサーバ

Posted at

PHPビルトインについて

会社でPHPビルトインを使用することがあったので、調べてみました :pencil2:

  • PHP5.4以降から「ビルトインウェブサーバ」というものが追加されている
  • PHPとデータベースさえインストールしてあれば、PHPファイルを動かすことができる
  • 簡易的なので、実運用では使用できない(ローカルでの使用)
  • 複数同時に起動はできない
  • Apacheではないので、 .htaccessは使用できない(「ルータースクリプト」が用意されている)

使用方法

コマンド上で、実行したいファイルに移動し以下のコマンドをたたく

cd path

$ php -S localhost:8000
  • php -S localhost:8000 (数字は任意)
  • ブラウザでhttp://localhost:8000/ にアクセスすると、index.phpが表示される
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1