Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm scaling a PHP application to multiple servers with a frontend webserver (running Apache) for static files and proxying dynamic requests for two application servers. My question is how do I run PHP on the application servers? From the Rails world I know application servers like Mongrel or thin which can host the application. What are the equivalents in PHP-land?

share|improve this question

5 Answers 5

up vote 4 down vote accepted

You should take a look at PHP-FPM. It is a PHP FastCGI implementation that should let you separate the PHP to its own application server.

share|improve this answer

As an extension of @cagenut's comment, I would recommend sticking with the simple case and using a reverse proxy (mod_proxy_http) under Apache to distribute load from a front-end to other servers. If you should choose to go the FastCGI route, you may wish to heed the advice toward the bottom of this post.

PHP normal practice differs from Ruby in some respects mainly mod_php is an extremely mature implementation (where Ruby seemed poorly suited for in-process embedding). There are benefits to running the PHP process out-of-band from Apache (security, isolation, control). Yet, if your purpose is to distribute load only, I would stick with the simpler implementation and wait for actual need before complicating the setup further.

share|improve this answer

Check out Photon - http://www.photon-project.com. Its still at its beginnings, but looks promising.

share|improve this answer
    
We generally prefer that you disclose your affiliation with the product. –  Scott Pack Mar 1 '11 at 21:16
    
@Scott: Well, the "product" is open source and the guy who is behind it created another open source tool I'm affiliated with. Sorry that this hasn't been made more clear. –  tommyd Jun 2 '11 at 21:34

You could run the applications using PHP-CLI for something simple, but PHP-FPM as suggested by carson is definitely a better option?

share|improve this answer

Why fight the common/simple case, run it as mod_php under apache.

share|improve this answer
    
I would really love to know who voted this down and why. –  cagenut Feb 24 '11 at 17:27
    
I would also like that. –  Prof. Falken Feb 13 '12 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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