laminas-api-tools / api-tools-skeleton

Skeleton Application for Laminas API Tools
https://api-tools.getlaminas.org/documentation
BSD 3-Clause "New" or "Revised" License
50 stars 64 forks source link

Built-in web server does not work for serving UI or API #21

Closed weierophinney closed 4 years ago

weierophinney commented 4 years ago

Bug Report

Q A
Version(s) 1.5.2 (likely all others), under PHP 7.1+ (have not tried it on earlier PHP versions)

Summary

When running the API Tools using the PHP built-in webserver per the instructions, the initial page redirects to /api-tools/ui, which presents a 404 from the built-in webserver itself.

Calls to API endpoints such as /api-tools/api/dashboard fail similarly.

Current behavior

See Summary.

How to reproduce

  1. Create a new project: composer create-project laminas-api-tools/api-tools-skeleton
  2. Remove bad entry for LaminasDeveloperTools from config/development.config.php.dist
  3. Fire up the built-in webserver: php -S 0:8080 -t public
  4. Browse to localhost:8080 and/or localhost:8080/api-tools/ui and/or localhost:8080/api-tools/api/dashboard.

Expected behavior

In a browser, the Admin UI should display.

When accessing an API endpoint, results should be presented.

weierophinney commented 4 years ago

One note: this works fine under the docker-compose setup, or when running PHP via php-fpm or mod_php. It is limited specifically to the built-in PHP webserver.

Xerkus commented 4 years ago

built-in webserver does not act as described in documentation: it does not try to find index.php or index.html in parent directory if subdirectory actually exists on the FS. It does work when route script is specified: php -S 0.0.0.0:8080 -t public public/index.php But that brings back the issue of inconsistency we encountered before where it couldn't find router script on different versions and/or OS

weierophinney commented 4 years ago

The instructions now point out that the server should be created using:

$ php -S 0.0.0.0:8080 -t public public/index.php

The last argument is a fallback to use if no file can be matched. When this argument is present, it works correctly.