LoginSignup
2
2

More than 5 years have passed since last update.

PHPビルドインサーバーに外部からつなぎたい場合

Posted at

(そのうち清書)

!PHP5.4.0以降の話

まずは外部から繋がるように

php -S localhost:8000

のような指定があったら、

php -S 0.0.0.0:8000

というような感じに。
ポートも開く。

URL書き換えしてる場合

.htrouter を作成し色々書いてみる。
こんな感じ

<?php
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
    $_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;

まぁここは状況次第。

最終的には

php -S 0.0.0.0:8000 .htrouter

となる。

今まで結構Apacheの設定とかやってましたが、ちょっと試すだけならこれで十分そう。

2
2
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
2