Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there anything that is a dead-simple PHP web server for Linux that literally takes a single PHP file and serves it via port 80. Don't want to configure a full blown web server like apache, lighttpd, or nginx. Just need to serve a single PHP script, and don't need vhosts. Would be awesome if it worked like:

$ simple-php-web-server myscript.php
share|improve this question

closed as not constructive by RobM, Dave M, mdpc, Smudge, Tom O'Connor Feb 26 '13 at 20:33

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

This showed up in a Google search. – Zoredache Oct 5 '11 at 8:14
Please tell me this is for development or testing, and won't be accessible from the Internet... – Soviero Feb 26 '13 at 14:54
busbyjon made a very simple PHP (2 script) webserver: – diyism Mar 19 '13 at 6:22

PHP 5.4+ includes a new command (docs):

php -S localhost:8000

Which will launch a simple PHP web server.

You can also make the web server accessible on port 8000 to any interface with:

php -S
share|improve this answer
This is documented here: – DerfK Dec 4 '12 at 2:20

You need a webserver - there's no way around that if you want to access the output of the scripts via http.

There are some very minimal webservers which will run PHP via CGI. e.g. monkey httpd (last time I had a look this compiled to 49kb) and which can run as daemons or via [x]inetd.

You might also have a look at nanoweb - a webserver written in PHP.

ISR there's some discussion over whether PHP6 will be bundled with a minimal webserver for dev/testing.

share|improve this answer

None that I know of but you can put one together fairly easily if you know some Java...

My first thought is if you can't find an existing solution then roll your own. Look at Netty it can do this (In particular the http server example and all you'd need is to use one of their examples to bind to port 80. Invoke the php command from java and feed the results back ( hack.

In reality though if you're putting this in a serious production environment then I'd highly urge you reconsider an established solution like the ones you've mentioned.

share|improve this answer

If you don't need a full http server, another option would be serving your script through xinetd (an example here ). But this way no http headers will be used.

share|improve this answer
So it's not really http then? – symcbean Oct 5 '11 at 10:49

NanoWeb might be of use to you.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.