Search code examples
phpsymfonyphp-builtin-server

Keeping Symfony2 built-in server from dying


I'm using bin/console server:run (or app/console for Sf2 directory structure) to develop applications using Symfony2. Unfortunately on multiple systems it dies eventually (usually because of a segfault).

I've tried multiple PHP versions and operating systems (5.5, 5.6 on Ubuntu 14.10 and 15.04, OS X 10.9 and 10.10).

I reported the errors and keep working, but I'm annoyed that I have to restart the server manually every now and then.

I tried to do something like this as my 'build target':

until bin/console server:run -v; do \
sleep 1; \
done

But unfortunately it only works sometimes (I'm yet to determine the reason why it fails to restart the server).

Can you recommend another way to keep this server up preferably without modyfiying the global services/deamons?


Solution

  • I managed to get this to work by using forever.js.

    It wasn't anything fancy, just

    forever start server.sh # sh contains bin/console server:run -v
    

    This question proved very helpful, as I could also include assetic watch and a couple other things.