Drupal php.ini optimizations

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
mherchel's picture

Hey High Performance Drupal,

I ran into this reddit thread on a php.ini optimization and figured I'd investigate this a bit more. I found a couple articles referencing this and figured I'd update Drupal.org's "Tuning PHP" documentation.

Looking at that page, it hasn't been updated since July 2009. So, my question to this group is what other tweaks, optimizations do you apply besides memory_limit, and the others listed.

Comments

Furthermore, the

mherchel's picture

Furthermore, the documentation page makes reference to this PHP presentation that's from 2004. Looking through this, I'm guessing its not very relevant anymore. Thoughts on this?

Yeah, I think realpath cache

dalin's picture

Yeah, I think realpath cache has been discussed in this group before. Good idea to get it into the handbook.

--


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

Drupal 8

aczietlow's picture

Should this be split for Drupal 7 and 8? I know in PHP 5.5 APC is in core, and offers optimization performance. Not sure if php should be tuned differently for the different versions?

D8 can run on PHP 5.4, so we

mherchel's picture

D8 can run on PHP 5.4, so we can't easily split it off there.

My understanding is the only real config specific to APC is increasing apc.shm_size. Maybe we edit and link this docs page on APC.

Is there any difference in the APC configuration PHP 5.5? If not we should edit the title, too. Thoughts?

Most folks will not use APC

brianmercer's picture

Most folks will not use APC as an opcode cache in PHP5.5. APC is probably being abandoned and PHP5.5 has the zend opcache built in with different settings than APC.

That being said, I'm using zend opcache with 5.5 and I'm using APCu with it. APCu is a fork of APC with all the opcache code stripped out and only the user cache code left in. It works well, though obviously it doesn't scale horizontally like a memcache/redis user cache.

I'm also planning on removing

mherchel's picture

I'm also planning on removing the first part where it states

If you have CPU cycles to spare, or if bandwidth is a more constrained resource than CPU cycles, you can add the following to php.ini: output_handler = ob_gzhandler

Both Apache's mod_deflate and Drupal's performance option to "Compress cached pages" handles gzipping the html. This makes this PHP configuration unnecessary.

Thoughts on this?

Yes the ob_gzhandler comments

dalin's picture

Yes the ob_gzhandler comments are both hard to understand, and irrelevant today.

--


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

Made changes to the PHP

mherchel's picture

Made changes to the PHP tuning page (https://drupal.org/node/2602) and created a child page for editing PHP’s realpath-cache-size and realpath-cache-ttl (https://drupal.org/node/2219781).

If anyone find any errors or omissions, either update the docs or post here and I'll update :)