There's manage.py runserver in Django or ruby script/server in Ruby on Rails — those familiar with one of those frameworks should already get the idea what I'm looking for. They run tiny "standalone" web server, which is perfectly enough to debug the application locally, without any need for other software (Apache/Nginx/Lighttpd/etc).
I wonder is there any PHP implementation of such tool, or, maybe, some PHP framework has such feature? Surely, I can pack pre-built pre-configured static nginx executable, but this would not be pretty, and certainly not cross-platform. Having standalone debug webserver written in PHP itself will make the package self-contained.
I.e. I'd like to type something like php tools/runserver.php, point browser to http://localhost:8000/ and see the site up and running, ready to debug.
My Google-fu has failed me, but I strongly suspect that there is such project already.
-
There is, I saw it recently! Can't remember the name/URL though!Alix Axel– Alix Axel2010年06月23日 18:12:17 +00:00Commented Jun 23, 2010 at 18:12
-
Thank you for good news. When I'm searching for something like "standalone php webserver" almost every result I get is someone's question "can I use PHP as standalone language?" (and then answers about php5-cli executable etc.)drdaeman– drdaeman2010年06月23日 18:15:09 +00:00Commented Jun 23, 2010 at 18:15
-
Check my answer, hopefully it is what you're looking for.Alix Axel– Alix Axel2010年06月23日 18:16:48 +00:00Commented Jun 23, 2010 at 18:16
-
2I wouldn't debug in something that was so fundamentally different from my production environment, personally.Frank Farmer– Frank Farmer2010年06月23日 18:22:49 +00:00Commented Jun 23, 2010 at 18:22
5 Answers 5
If you just want to debug your application, as of PHP 5.4 there's a built-in web server.
http://docs.php.net/manual/en/features.commandline.webserver.php
2 Comments
php -S localhost:8000 -t foo/Not sure if this is what you're after, though it's actually more like a Tomcat for PHP, and I think (though I'm not sure) it still requires a webserver
Also, nanoweb is a web server written entirely in PHP
6 Comments
1 Comment
May worth mentioning:
- https://github.com/dhotson/kelpie
- https://github.com/indeyets/appserver-in-php (requires C extension)
There's also an proporsal to have server built-in into PHP CLI binary: http://wiki.php.net/rfc/builtinwebserver
Comments
Check Pancake HTTP server too, it has an interesting declared speed in its author's benchmark that may make it suited for deployment as well.
Notice that it will only work well on Linux systems, that I know of. Due to missing signaling syscalls, like sigwaitinfo, I wasn't able to build it on OS X.