20

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.

4
  • There is, I saw it recently! Can't remember the name/URL though! Commented 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.) Commented Jun 23, 2010 at 18:15
  • Check my answer, hopefully it is what you're looking for. Commented Jun 23, 2010 at 18:16
  • 2
    I wouldn't debug in something that was so fundamentally different from my production environment, personally. Commented Jun 23, 2010 at 18:22

5 Answers 5

23

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

Sign up to request clarification or add additional context in comments.

2 Comments

SO has no practice of "not reviving old threads" because knowledge is constantly updating yet the questions remain the same. Anyways, great tip thank you that is EXACTLY what I was looking for.
e.g. php -S localhost:8000 -t foo/
3

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

Requirements: Web-Server with SCGI support (Apache, lighttpd, …).
Thanks, but, no, it works under SCGI. What I'm looking for is just a simple and tiny HTTP server, capable of serving static files and running PHP code — nothing more. Obviously, there's no need for performance, security or any fancy features.
@drdaeman added link to nanoweb, written in PHP4.3. IIRC you need cygwin to run it under Windows - at least you used to, haven't used it in a long while
Oh I do so love people who mark down without any explanation, especially 9-months later
Ok, here goes: your answer is half answer, "half un-answer". (The Tomcat for PHP part.) Hence downvote after 2 years.
|
3

Found it: QuickPHP!


Check these out:

1 Comment

Thanks. Not exactly what I'm looking for, though, because it's Windows-only binary — I've mentioned that when I wrote about shipping statically built nginx executable. I happen to develop mostly on GNU/Linux, while my friend works on MS Windows. And there are OS X guys out there too. Having webserver written in PHP would be ideal, as PHP is already the requirement anyway.
1

May worth mentioning:

There's also an proporsal to have server built-in into PHP CLI binary: http://wiki.php.net/rfc/builtinwebserver

(Source: http://news.ycombinator.com/item?id=2281724)

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.