Installing Drupal with PHP-FPM

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

Running into all sort of problems after trying to configure Drupal 7 to run on PHP-FPM on CentOS 6.2 Apache 2.2 this week.

I was reviewing @kbahey 2bits.com excellent article on configuring Drupal to run with fcgid and I was wondering if we could use that as a starting point to explore a PHP-FPM deployment.

http://2bits.com/articles/apache-fcgid-acceptable-performance-and-better...

I am getting a series of timeout/server 500 errors in my httpd/logs/error_log such as these after install:

[Sat Apr 05 13:26:01 2014] [error] [client 99.224.###.###] FastCGI: comm with server "/usr/lib/cgi-bin/php5-fcgi" aborted: idle timeout (30 sec), referer: http://[###]/admin
[Sat Apr 05 13:26:01 2014] [error] [client 99.224.###.###] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php5-fcgi", referer: http://[###]/admin

Anyone successfully running Drupal 7on PHP-FPM on Centos 6.2? etc?

Comments

PHP-FPM Works fine on Ubuntu LTS 12.04

kbahey's picture

As mentioned in the article on my site, PHP-FPM works really well, and obsoletes fcgid.

We run it on Ubuntu LTS 12.04.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Are u using APC module or

urwithraj's picture

Are u using APC module or ZendOpCache , if APC please remove that install ZendOpCache.

APC vs ZendOpCache

trainingcity's picture

Hi @urwithraj. I am running APC. There seems to be some confusion about the viability of APC moving forward. I am running a Drupal multi-site deployment, will ZendOpCache still be the better option? If so, what are the pros/cons of switching from APC on an older Centos 6.2 LAMP/PHP-FPM drupal 7 deployment?

Yes ZendOpCache is what

urwithraj's picture

Yes ZendOpCache is what Acquia also recommended. APC module is getting depreciated so i will suggest you to remove APC and move to ZendOpCache.

APC deprecated?

ben.hamelin's picture

@urwithraj, can you comment / provide resources to review on APC deprecated? Is this because of the built in op code cache in PHP 5.5? Thanks in advance for clarifying!

Yes thats correct op code

urwithraj's picture

Yes thats correct op code cache is now build in with PHP 5.5

https://bugs.php.net/bug.php?id=64625 ( recommended byRasmus Lerdorf himself) --- If you are having problems with APC and PHP 5.4 I suggest trying
http://pecl.php.net/package/ZendOpcache instead. That is where development is focused now

More here:
http://wordpress.org/support/topic/looking-ahead-to-php-55-zend-optimize...

Feed back from Acquia support - We recently released PHP 5.5 with Zend OpCache, and it has been thoroughly tested on our platform over the past several weeks with no reported issues thus far

Hope this works :)

Also we had same issue as reported by @trainingcity and moving to ZendOpCache fixed all those 500 errors :)

Thanks!

Memcached socket access

trainingcity's picture

I was wondering if anyone changed their php-fpm config to listen on a socket and if so, did you also change your memcache/memcached config setting to use the same socket?

I made the following changes in a centos 6.x apache install:

changed /etc/php-fpm.d/www.conf as follows:
changed listen line to:

listen = /var/run/php5-fpm.sock

Changed my memcached config file

/etc/sysconfig/memcached

to use the same socket:

commented out

Port "####"

and

OPTIONS

added

Listen on a Unix Socket

-s /var/run/php5-fpm.sock
-a 666

Any thoughts on this are welcome.

Different things

kbahey's picture

These are totally different things, independent from each other.

What PHP-FPM's listen, whether socket or IP, is where PHP-FPM listens for requests from the web server.

Memcache listens to connections from PHP for cache get/set requests.

Don't confuse yourself.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Should Memcache listen on a Unix socket?

trainingcity's picture

I guess then that the question is should memcached be listening on a unix socket or the TCP port?

UNIX domain sockets are only

FluxSauce's picture

UNIX domain sockets are only local. If memcached is going to be running only on the local server, then sockets are faster. If memcached is going to be on a different server / IP, then you can't use sockets.

Another socket

kbahey's picture

If you don't want memcached to use a network socket, then yes, you can make it listen on a socket, provided that no other machine will access memcached. But it has to be its own socket, not the one PHP-FPM is using (nor any other daemon on the same machine).

http://code.google.com/p/memcached/wiki/NewConfiguringServer#Unix_Sockets

But then you also have to configure Drupal to use UNIX sockets to conncet to memcached, which I have not seen documented much.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Unix socket vs TCP socket

trainingcity's picture

Excellent points. @kbahey, thanks, I meant to use a unique unix socket for memcached, not the same one. I hadn't thought about drupal needing to access the unix socket so it could communicate with memcached.

@Fluxsauce I'm running on one server, but the point is well taken that the unix socket is ONLY applicable if everything is running on a single server.

As for performance, does anyone know how significant the performance improvement is between a unix socket and the TCP/UDP socket?