PHP/php5-fpm

Aus crazylinux.de
< PHP
Zur Navigation springen Zur Suche springen

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. These features include:

  • Adaptive process spawning (NEW!)
  • Basic statistics (ala Apache's mod_status) (NEW!)
  • Advanced process management with graceful stop/start
  • Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode)
  • Stdout & stderr logging
  • Emergency restart in case of accidental opcode cache destruction
  • Accelerated upload support
  • Support for a "slowlog"
  • Enhancements to FastCGI, such as fastcgi_finish_request() - a special function to finish request & flush all data while continuing to do something time-consuming (video converting, stats processing, etc.)

and much more.


Apache config

enable fastcgi apache module

FastCgiExternalServer /usr/lib/cgi-bin/php5 -socket /var/run/php5-fpm.sock -pass-header Authorization

Alias /php5-fcgi /usr/lib/cgi-bin/php5
Action application/x-httpd-php  /php5-fcgi
#disable mod_php
php_admin_value engine Off

<Directory /usr/lib/cgi-bin/>
   Options +ExecCGI -MultiViews -Indexes
   AllowOverride None
   Allow from all
</Directory>

php5-fpm deamon

#/etc/php5/fpm/php-fpm.conf

error_log = /var/log/apache2/php5-fpm.log
log_level = warning
process.max = 128


#/etc/php5/fpm/pool.d/www.conf

listen = /var/run/php5-fpm.sock
pm.max_children = 20
slowlog = log/$pool.log.slow
security.limit_extensions = .php .php3 .php4 .php5