Phalcon with PHP built-in http server fails on die

Hi,

I'm getting a strange behaviour with php built-in server and Phalcon. Created a project using dev-tools, then run it like this:

php -S localhost:1337 -t public .htrouter.php

Everything works great until I use exit or die inside of a controller. First request is rendered with as normal and then after a refresh I get PHP fatal error like this:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '.htrouter.php' (include_path='.:') in Unknown on line 0

My PHP version 5.6.13.



3.7k

My guess would be the die/exit is killing the server. See if the process is still going after the exit.

Try return instead.

edited Sep '15

Server is running, first request with 200 response, then fails on everything.

MacBook-Pro-Aleksander ~/php/tree$ php -S localhost:1337 -t public .htrouter.php

[Sat Sep 19 19:24:42 2015] 127.0.0.1:50177 [200]: /

[Sat Sep 19 19:24:43 2015] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

[Sat Sep 19 19:24:43 2015] PHP Fatal error: Unknown: Failed opening required '.htrouter.php' (include_path='.:') in Unknown on line 0

[Sat Sep 19 19:24:46 2015] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

[Sat Sep 19 19:24:46 2015] PHP Fatal error: Unknown: Failed opening required '.htrouter.php' (include_path='.:') in Unknown on line 0

Seems like any fatal error is causing server to loose its include path :/



3.7k

Try with an absoulte path to the include