Home > Backend Development > PHP Tutorial > Linux系统下PHP-FPM的安装和配置教程_PHP

Linux系统下PHP-FPM的安装和配置教程_PHP

WBOY
Release: 2016-05-30 08:46:58
Original
1042 people have browsed it

基本安装方法

安装工具包

  $ sudo apt-get install python-software-properties 
Copy after login

添加ppa源

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

Copy after login

安装php5-fpm

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

Copy after login

其它必要的软件安装接

  sudo  apt-get  install  nginx 

Copy after login


配置php-fpm


php-fpm的解析器是C/S结构,它的配置文件位于:
(1)/etc/php5/fpm/php-fpm.conf
(2)/etc/php5/fpm/pool.d/
一般没什么严格的配置的要求,或者说这块我还没有具体的研究每个配置参数的意义
我采用了tcp模式与fastcgi进程进行连接,因此我修改了tcp监听的地址和端口,修改了一下监视目录的名称,这里不做具体详细解释了,大家可以参考官方文档根据自己的需求进行配置

重启php5-fpm

安装提示错误解决
如果服务器的系统源中没有php5-fpm,安装的时候会提示:

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

解决办法

1. 添加非官方的源到 /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 

Copy after login

2. 安装php5-fpm

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

Copy after login

3. 安装php扩展组件

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

Copy after login

4. 启动php-fpm

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

Copy after login

php.in位于/etc/php5/fpm/php.ini

php-fpm.ini位于/etc/php5/fpm/php5-fpm.conf


php-fpm启动时报错

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

Copy after login

locate libgd 查看gd的动态库位置,如果/usr/local/lib/目录里有则

rm /usr/local/lib/libgd*

Copy after login

重启php-fpm即可

去掉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

Copy after login

把#变成;即可去掉该提示


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template