Guidelines for Configuring Apache/PHP

Events happening in the community are now at Drupal community events on www.drupal.org.
rockitdev's picture

I am looking for some guidelines on properly configuring apache/php for Drupal. I realize this is a bit of a "it all depends on x, y or z" type of question, but I would greatly appreciate any resources/recommendations that outline best practices for configuration and optimization of apache?

Comments

There's really nothing

dalin's picture

There's really nothing special that you need to do to PHP or Apache to configure it for Drupal. Any general guides that you find on the Internet on how to setup these tools on your OS will work for Drupal.

--


Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his

1) PHP op-code

Peter Bowey's picture

1)

PHP op-code cache/accelerators

Complex PHP applications, such as Drupal, can gain a lot of performance benefits from running a PHP op-code cache/accelerators.

APC, Alternate PHP Cache, is becoming the most maintained free/open source op-code cache, and is being used more and more as it emerges to be stable. See: http://www.morningtime.com/Drupal-6x-Performance-Guide/III-Drupal-Server...

2)

Improving Website Performance (With Drupal, PHP, MySQL and Apache):

see: http://www.bootstrappingindependence.com/technology/how-to-improve-websi...

3)

Drupal LAMP Server Tuning.

See http://cruncht.com/89/drupal-lamp-server-tuning/

4)

Guidelines: Drupal Version 7 on Linux/Apache/MySQL/PHP

see: http://portalbuilders.pro/PBblog/?p=493

--
Linux: Web Developer
Peter Bowey Computer Solutions
Australia: GMT+9:30
(¯`·..·[ Peter ]·..·´¯)

Actually this greatly depends

Jamie Holly's picture

Actually this greatly depends upon x, y and z. The best thing to do is to read through some of the links provided and get a basic understanding of LAMP tuning and optimization tricks (APC, cacherouter, boost, etc.), but you still got to do a lot of the legwork on your own. You need to take time and benchmark your site and tune accordingly to accommodate not only things like resource limits, but also code and even configuration (by configuration a big thing is views and panels. You can have two sites using these modules that get very different results depending upon the view and or panel).

To give a real life example of this, I have two clients, both running on the same version of D6. One site was built by me and one built by a rather larger Drupal shop. Both site's were conversions from Wordpress and both run on the exact same hardware and OS. Actually both are now hosted by the same hosting company (and physically the servers are two racks apart in the same DC). On the site I built, they see an average of 165,000 pageviews per day. The average server load is 0.35 and the average page is delivered in 350ms. The one I didn't build (am working on rebuilding it now) sees an average of 20,000 pvs per day and has an average serverload of 2.75 and the average page is delivered in 1.2seconds. The difference is in how the sites were built and configured (actually since I took over the second one, I've more than double performance by dropping some modules and putting the code into custom modules, plus doing some extra configuration tuning).

My approach to tuning is always the same - benchmark, tune, benchmark, tune, benchmark, tune. To properly benchmark you need to use a tool like jMeter. Learn how to use the tool to setup a profile to mimic average user activities (creating nodes, posting comments, registering, etc.). Here's a good link to get you started on that:

http://www.johnandcailin.com/blog/john/load-test-your-drupal-application...

If you are going with a new server, then great, you can perform the tests against that. If not then you can setup a VM on your home computer and test on that, getting an idea what areas can be tuned. Once you got that idea, move those over to your live server and guesstimate an adjustment for them, accounting for the extra resources. After that you can fine tune later, but you'll at least get an idea where to start.

I know it's most likely not the answer you wanted, but given how fluid Drupal installations can be from one to the other, this is really the best route, plus it provides a great way to learn more about the underlying systems that help deliver your site (Apache, PHP and MySQL).

(If you're going from a live site and already on the server, then I suggest installing monitoring software like Munin to keep an eye on things so that you can help identify which areas of the server need the most attention. It will save you a lot of time and frustration)


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: