Home > php教程 > php手册 > Linux系统下PHP-FPM的安装和配置教程

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

WBOY
Release: 2016-06-06 19:48:32
Original
1203 people have browsed it

这篇文章主要介绍了Linux系统下PHP-FPM的安装和配置教程,PHP-FMP是用于PHP的FastCGI管理器,经常被用于配置PHP和服务器软件,需要的朋友可以参考下

基本安装方法

安装工具包

$ sudo apt-get install python-software-properties

添加ppa源

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

安装php5-fpm

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

其它必要的软件安装接

sudo apt-get install nginx


配置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 lucid main" >> /etc/apt/sources.list echo "deb-src lucid main" >> /etc/apt/sources.list

2. 安装php5-fpm

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

3. 安装php扩展组件

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

4. 启动php-fpm

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

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

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

rm /usr/local/lib/libgd*

重启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

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


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template