PHP built-in web server is not finding assets
I have a php project built with Zend Framework 2. In want to start the built-in server to developing with the following command:
sudo php -S localhost:8080 -t public/ public/index.php
All the functionality of Zend Frameowrk 2 are working fine but I get 404 errors when retrieving the assets.
The assets are in the public/css, public/img and public/js folder. GET http://localhost:8080/css/bootstrap.css [HTTP/1.1 404 Not Found 10ms] GET http://localhost:8080/css/dlu-tw-bootstrap.css [HTTP/1.1 404 Not Found 21ms] GET http://localhost:8080/css/style.css [HTTP/1.1 404 Not Found 35ms] GET http://localhost:8080/js/bootstrap.js [HTTP/1.1 404 Not Found 45ms]
Any idea on how to allow the built-in server to access these files?
As I understood from reading this blog post, you either need to start your command from the right folder and not specify any -t option
$ cd public $ sudo php -S localhost:8080
Or you need to write your own routing rules in the index.php