1

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?

derfred
  • 113
  • 6

5 Answers5

4

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.

carson
  • 1,630
  • 11
  • 15
1

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.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
Jeff Stice-Hall
  • 349
  • 2
  • 5
1

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

tommyd
  • 111
  • 2
  • We generally prefer that you disclose your affiliation with the product. – Scott Pack Mar 01 '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 02 '11 at 21:34
0

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

gAMBOOKa
  • 999
  • 6
  • 19
  • 34
0

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

cagenut
  • 4,848
  • 2
  • 24
  • 29