LoginSignup
0
0

More than 3 years have passed since last update.

メモ - GAE/SE php72,73 ローカル実行時の設定

Last updated at Posted at 2019-10-01

php73@gae でローカルでテストするときのメモ。

php72/73 では dev_appserver.py が無くなったので、普通に php インストールしてテストする。

が、普通に

php -S localhost:8080

とかやるだけだと、gaeにデプロイした時と違う挙動になる。

app.yaml
runtime: php73
entrypoint: serve --workers=4 --enable-dynamic-workers index.php 
index.php
<?php
switch (@parse_url($_SERVER['REQUEST_URI'])['path']) {
    case '/':
        require 'hello.php';
        break;
    case '/test':
        require 'test.php';
        break;
    case '/dir/test':
        require 'dir/test.php';
        break;
    default:
        http_response_code(404);
        exit('Not Found');
}

とかのデバッグをローカルでやる場合、

は問題ないが

Not Found
The requested resource /dir/test was not found on this server.

となってしまう。

この場合、ビルトインウェブサーバーの起動時にルータースクリプトとして index.php を指定するとよい。

php -S localhost:8080 index.php
0
0
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
0
0