Home  >  Article  >  Backend Development  >  Installation and configuration tutorial of PHP-FPM under Linux system_php skills

Installation and configuration tutorial of PHP-FPM under Linux system_php skills

WBOY
WBOYOriginal
2016-05-16 20:08:271608browse

Basic installation method

Installation toolkit

  $ sudo apt-get install python-software-properties 

Add ppa source

  $ sudo add-apt-repository ppa:yola/php5 

Install php5-fpm

  sudo apt-get update 
   
  sudo apt-get install php5-fpm 

Other necessary software installation links

  sudo  apt-get  install  nginx 


Configure php-fpm


The parser of php-fpm is a C/S structure, and its configuration file is located at:
(1)/etc/php5/fpm/php-fpm.conf
(2)/etc/php5/fpm/pool.d/
Generally there are no strict configuration requirements, or I haven’t studied the meaning of each configuration parameter in detail
I used tcp mode to connect to the fastcgi process, so I modified the address and port of tcp monitoring, and modified the name of the monitoring directory. I will not explain it in detail here. You can refer to the official documentation to configure it according to your own needs

Restart php5-fpm

Installation prompt error resolution
If there is no php5-fpm in the server’s system source, you will be prompted during installation:

Reading state information... Done
E: Couldn't find package php5-fpm

Solution

1. Add unofficial sources to /etc/apt/sources.list

echo "deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main" >> /etc/apt/sources.list 
echo "deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main" >> /etc/apt/sources.list 

2. Install php5-fpm

sudo apt-get update && sudo apt-get install php5-fpm

3. Install php extension

sudo apt-get install php-apc php5-curl php5-gd php5-imagick php5-mysql\
 php5-memcache php5-memcached php5-mcrypt

4. Start php-fpm

sudo /etc/init.d/php5-fpm start

php.in is located at /etc/php5/fpm/php.ini

php-fpm.ini is located in /etc/php5/fpm/php5-fpm.conf


php-fpm reports an error when starting

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/gd.so' - 
/usr/lib/php5/20060613+lfs/gd.so: undefined symbol: gdImageCreateFromJpeg in Unknown on line 0

locate libgd Check the dynamic library location of gd, if it is in the /usr/local/lib/ directory

rm /usr/local/lib/libgd*

Just restart php-fpm

Remove the warning message when starting php-fpm

PHP Deprecated: Comments starting with '#' are deprecated in 
/etc/php5/fpm/conf.d/imagick.ini on line 1 in Unknown on line 0

Change # to; to remove this prompt


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn