{"id":1426,"date":"2014-09-22T14:13:28","date_gmt":"2014-09-22T18:13:28","guid":{"rendered":"http:\/\/mossiso.com\/?p=1426"},"modified":"2014-09-22T14:13:28","modified_gmt":"2014-09-22T18:13:28","slug":"setting-up-a-hosting-environment-part-5-apache-and-php","status":"publish","type":"post","link":"https:\/\/mossiso.com\/2014\/09\/22\/setting-up-a-hosting-environment-part-5-apache-and-php\/","title":{"rendered":"Setting up a Hosting Environment, Part 5: Apache and PHP"},"content":{"rendered":"

Figuring out the possibilities for Apache and PHP reminds me of a Dr. Seuss book, “Fox in Sox”. It’s a favorite of mine. I love reading it to the kids. In it, Mr. Fox tries to get Mr. Knox to say all kinds of ridiculous (in meaning and hard to say) tongue twisters. At one point Mr. Knox exclaims:
\n“I can’t blab such blibber blubber!
\nMy tongue isn’t make of rubber.”<\/p>\n

That’s what my brain felt like after trying to figure all of the options for Apache and PHP. To combat my rubber brain, I created this flow-chart to help me keep track of the options, the pros and cons for each, and the path I finally chose.<\/p>\n

First off, a list of requirements and goals:<\/p>\n

    \n
  1. Chroot each vhost to it’s own directory, and have Apache and PHP run on that vhost’s server account<\/li>\n
  2. Speed, run Apache and PHP at their most effective and efficient levels<\/li>\n
  3. Utilize an opcode cache, APC, to speed up PHP pages<\/li>\n
  4. Use trusted repositories to make installation and upgrading easier<\/li>\n<\/ol>\n

    Here’s what I eventually figured out about Apache and PHP:<\/p>\n

    \"ApachePHP\"<\/a>
    Click on the image to see a larger view<\/figcaption><\/figure>\n

    These sites were helpful for the initial set up of PHP as CGI with mod_fcgi and Apache in chroot (mod_fcgi sends one request to each PHP process regardless if PHP children are available to handle more, and no sharing of APC opcode cache across PHP processes):<\/p>\n