- 浏览: 1159567 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
MyEyeOfJava:
产生问题的主要原因:1.方洪波与南枫公司的直接主管李琼在合作共 ...
人力资源管理案例-左右为难的经理 -
吾名长弓:
学习了,作为一个管理新手,从文章里学到了很多东西,感谢 ...
2018新年管理感言 -
MyEyeOfJava:
非常不错,看过很多文章,说到管理者必然不能抛弃技术,我的主张是 ...
IT行业技术部门人员架构设计 -
小灯笼:
JMeter测试从入门到精通网盘地址:https://pan. ...
LR与Jmeter相关资料 -
flying6071:
“(2)CERT.SF:这是对摘要的签名文件。对前一步生成的M ...
Android签名与认证详细分析之一(CERT.RSA剖析)
网上搜索 大部分都是讲怎么编译安装的, 自己也搜索过ubuntu的源, 没有单独的php5-fpm的安装包, 不过按照一个老外的安装方法, 还是可以不用编译的。
第一步:
aptitude install python-software-properties
第二步:
add-apt-repository ppa:brianmercer/php
第三步:
aptitude -y update
第四步:
aptitude -y install php5-fpm
安装好后, 配置一下 /etc/php5/fpm/php5-fpm.conf
pm.max_children 设置大一点, 默认是10, 这是php5-fpm的进程数。
然后就是 service php5-fpm start 启动。
php5-fpm是可以平滑重启的,修改了php.ini文件后, 用service php5-fpm reload 就能重新加载配置文件。
I've been using the dotdeb.org pacakges for my ubuntu 9.10 servers and they've been running well, except for some necessary patches to contrib modules for php 5.3.
Now ubuntu 10.04 lucid is out and has php 5.3.2 in it. While php5-fpm won't be included in an official release until at least 5.4, it has become a part of official php development and is contained in the php version control.
In order to ease installation and upgrade, I've created a debian style .deb package for php5-fpm on launchpad at https://launchpad.net/~brianmercer/+archive/php/. Unlike the dotdeb package, this one is adapted from the official ubuntu lucid source package and so has identical patches and compile options to the ubuntu 10.04 cgi and cli sapis.
This package will only work on the Ubuntu 10.04 lucid release.
and if you don't want to get the unsigned package warnings, add the launchpad key for the ppa with this command:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8D0DC64F
Then it's the usual:
You can then start (or stop or restart) php5-fpm with:
The new package works with all the usual ubuntu php extensions like php5-mysql, php5-gd, php-apc and php5-memcache.
The config file is now in an ini style format instead of the xml format and is located at /etc/php5/fpm/php5-fpm.conf. By default it listens on 127.0.0.1:9000 but I typically change the conf to use a unix socket at /var/run/php5-fpm.sock. If you use a socket, you should also uncomment the user and group and mode in the conf file. (I also change the mode to 0660)
I've set the package to start up 10 children by default. You can increase or decrease that amount depending on your memory constraints. There is a "dynamic" setting in the conf file with starting number, max number, max idle, etc. This "apache-like" system will start and stop children as needed depending on load. However, it is still experimental and it may be better to stick with the static setting for now.
I've also set up a second repository at https://launchpad.net/~brianmercer/+archive/fcgiwrap with fcgiwrap. nginx does not have the built in ability to act as a cgi gateway for perl scripts, etc, the way that apache and most other web servers do. In order to use things like awstats.pl or nagios you need to proxy those requests to a backend. I previously ran thttpd and let nginx proxy *.pl and *.cgi requests to thttpd. (boa also worked). However, Grzegorz Nosek has written a small wrapper script in C to handle these requests which works well. http://nginx.localdomain.pl/wiki/FcgiWrap
I've gone ahead and made a debian package from his code and put it up at https://launchpad.net/~brianmercer/+archive/fcgiwrap and it can be installed the same way as php5-fpm by adding the following to /etc/apt/sources.list:
and
My fcgiwrap package relies on spawn-fcgi but it has its own start/stop init script so you can use
It runs on 127.0.0.1:8000 by default but you can change the config file at /etc/default/fcgiwrap to also make it run as a unix socket at /var/run/fcgiwrap.sock.
Then you can put a location in your nginx config such as
You should be aware of the serious security implications of that section. You don't want someone uploading a nasty perl script to your server and running it. A section like that should only exist behind a protected subdomain or at least should have password authentication added to it. If you're only using awstats then instead of using the location above you can use one like this:
I hope these packages are useful and that they ease one of the complications of installing and using nginx.
Login or register to post comments
Comments
php5-fpm for Debian Lenny
Posted by omega8cc on May 23, 2010 at 4:41pm
Thanks for this how-to, Brian.
Since dotdeb.org has also php5-fpm for Debian Lenny and it works great, however still there are too many issues with PHP 5.3 in many contrib Drupal modules, so we are using it only for testing on our dev servers.
Simple how-to for all Debian fans:
See also: http://www.dotdeb.org/instructions/
~Grace
Login or register to post comments
I was using the dotdeb repos
Posted by brianmercer on May 23, 2010 at 5:26pm
I was using the dotdeb repos on ubuntu 9.10 for a while and they worked perfectly, and it's good of Guillaume Plessis to make those packages available. I also owe him thanks because I used his scripts to make my Ubuntu packages.
To use the dotdeb packages on Ubuntu instead of Debian you have to manually install two packages:
and one more if you use php5-mycrypt:
http://mirrors.kernel.org/ubuntu/pool/main/libt/libtool/libltdl3_1.5.26-...
I repackaged php5-fpm for Ubuntu on a launchpad ppa for 3 reasons:
First, I wanted to avoid the extra work for Ubuntu users of manually adding the packages above.
Second, I wanted to have php built with the identical compile options and patches as Ubuntu's current 10.04 php. Guillaume uses the php bundled gd (which is not a bad idea) and also the mysqlnd native driver, whereas Debian and Ubuntu use the official gd and the libmysql driver. There are also several code patches that Ubuntu applies that Guillaume doesn't. I wanted my php-fpm to match the decisions of the Ubuntu packagers.
Ubuntu has updated php5 twice this month to incremental releases php5-5.3.2-1ubuntu4.1 and php5-5.3.2-1ubuntu4.2 and I wanted to be able to track those patches immediately and add them to my php-fpm build.
Third, I wanted the latest version of php-fpm. Guillaume is using the fpm patch from last year that has proved very stable but didn't receive full attention from the fpm originator Andrei Nigmatulin. By the time version 5.3 and 5.2.13 were released, Andrei had already stopped updating his great work. As far as I know, there's no dev maintaining the 5.2.x branch.
Luckily, since then, fpm has been merged into the official php.net development trunk and is now actively maintained by Antony Dovgal and Jerome Loyet, two php.net devs. Jerome has put in some good work bringing in the apache-like dynamic child spawning, and Antony has been committing patches based on reported problems. They've also committed a conversion from an xml conf file to the ini format.
I'm using the very latest svn development version of fpm to get the benefits of the new code and watchful eye of php.net devs.
I completely agree with you about the state of Drupal contrib modules (and core) with respect to 5.3 compatibility. I'm up to nine patches that I have to apply now to core and to contrib modules that I use.
第一步:
aptitude install python-software-properties
第二步:
add-apt-repository ppa:brianmercer/php
第三步:
aptitude -y update
第四步:
aptitude -y install php5-fpm
安装好后, 配置一下 /etc/php5/fpm/php5-fpm.conf
pm.max_children 设置大一点, 默认是10, 这是php5-fpm的进程数。
然后就是 service php5-fpm start 启动。
php5-fpm是可以平滑重启的,修改了php.ini文件后, 用service php5-fpm reload 就能重新加载配置文件。
I've been using the dotdeb.org pacakges for my ubuntu 9.10 servers and they've been running well, except for some necessary patches to contrib modules for php 5.3.
Now ubuntu 10.04 lucid is out and has php 5.3.2 in it. While php5-fpm won't be included in an official release until at least 5.4, it has become a part of official php development and is contained in the php version control.
In order to ease installation and upgrade, I've created a debian style .deb package for php5-fpm on launchpad at https://launchpad.net/~brianmercer/+archive/php/. Unlike the dotdeb package, this one is adapted from the official ubuntu lucid source package and so has identical patches and compile options to the ubuntu 10.04 cgi and cli sapis.
This package will only work on the Ubuntu 10.04 lucid release.
In order to install the package, you need to add the following to your /etc/apt/sources.list file:
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main
and if you don't want to get the unsigned package warnings, add the launchpad key for the ppa with this command:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8D0DC64F
Then it's the usual:
sudo aptitude update sudo aptitude install php5-fpm
You can then start (or stop or restart) php5-fpm with:
sudo service php5-fpm start
The new package works with all the usual ubuntu php extensions like php5-mysql, php5-gd, php-apc and php5-memcache.
The config file is now in an ini style format instead of the xml format and is located at /etc/php5/fpm/php5-fpm.conf. By default it listens on 127.0.0.1:9000 but I typically change the conf to use a unix socket at /var/run/php5-fpm.sock. If you use a socket, you should also uncomment the user and group and mode in the conf file. (I also change the mode to 0660)
I've set the package to start up 10 children by default. You can increase or decrease that amount depending on your memory constraints. There is a "dynamic" setting in the conf file with starting number, max number, max idle, etc. This "apache-like" system will start and stop children as needed depending on load. However, it is still experimental and it may be better to stick with the static setting for now.
I've also set up a second repository at https://launchpad.net/~brianmercer/+archive/fcgiwrap with fcgiwrap. nginx does not have the built in ability to act as a cgi gateway for perl scripts, etc, the way that apache and most other web servers do. In order to use things like awstats.pl or nagios you need to proxy those requests to a backend. I previously ran thttpd and let nginx proxy *.pl and *.cgi requests to thttpd. (boa also worked). However, Grzegorz Nosek has written a small wrapper script in C to handle these requests which works well. http://nginx.localdomain.pl/wiki/FcgiWrap
I've gone ahead and made a debian package from his code and put it up at https://launchpad.net/~brianmercer/+archive/fcgiwrap and it can be installed the same way as php5-fpm by adding the following to /etc/apt/sources.list:
deb http://ppa.launchpad.net/brianmercer/fcgiwrap/ubuntu lucid main deb-src http://ppa.launchpad.net/brianmercer/fcgiwrap/ubuntu lucid main
and
sudo aptitude update sudo aptitude install fcgiwrap
My fcgiwrap package relies on spawn-fcgi but it has its own start/stop init script so you can use
service fcgiwrap start
It runs on 127.0.0.1:8000 by default but you can change the config file at /etc/default/fcgiwrap to also make it run as a unix socket at /var/run/fcgiwrap.sock.
Then you can put a location in your nginx config such as
location ~ (.cgi|.pl)$ { # auth_basic "Restricted"; # auth_basic_user_file /var/private/htpasswd; # somewhere outside the http root gzip off; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:8000; # fastcgi_pass unix:/var/run/fcgiwrap.sock; #if using unix socket instead of TCP }
You should be aware of the serious security implications of that section. You don't want someone uploading a nasty perl script to your server and running it. A section like that should only exist behind a protected subdomain or at least should have password authentication added to it. If you're only using awstats then instead of using the location above you can use one like this:
location = /awstats.pl { gzip off; root /usr/lib/cgi-bin; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME /usr/lib/cgi-bin/awstats.pl; fastcgi_pass 127.0.0.1:8000; # fastcgi_pass unix:/var/run/fcgiwrap.sock; } location ~ ^/awstats-icon/(.*)$ { alias /usr/share/awstats/icon/$1; }
I hope these packages are useful and that they ease one of the complications of installing and using nginx.
Login or register to post comments
Comments
php5-fpm for Debian Lenny
Posted by omega8cc on May 23, 2010 at 4:41pm
Thanks for this how-to, Brian.
Since dotdeb.org has also php5-fpm for Debian Lenny and it works great, however still there are too many issues with PHP 5.3 in many contrib Drupal modules, so we are using it only for testing on our dev servers.
Simple how-to for all Debian fans:
sudo echo "deb http://php53.dotdeb.org stable all" >> /etc/apt/sources.list sudo echo "deb-src http://php53.dotdeb.org stable all" >> /etc/apt/sources.list sudo apt-get update sudo apt-get -y install php5-cli php5-common php5-suhosin php5-memcache php5-imagick php5-apc php5-dev sudo apt-get -y install php5-curl php5-gd php5-imap php5-mcrypt php5-mysql php5-xsl php-pear sudo apt-get -y install php5-fpm php5-cgi invoke-rc.d php5-fpm start
See also: http://www.dotdeb.org/instructions/
~Grace
Login or register to post comments
I was using the dotdeb repos
Posted by brianmercer on May 23, 2010 at 5:26pm
I was using the dotdeb repos on ubuntu 9.10 for a while and they worked perfectly, and it's good of Guillaume Plessis to make those packages available. I also owe him thanks because I used his scripts to make my Ubuntu packages.
To use the dotdeb packages on Ubuntu instead of Debian you have to manually install two packages:
http://us.archive.ubuntu.com/ubuntu/pool/main/k/krb5/libkrb53_1.6.dfsg.4... http://us.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8-6ubuntu...
and one more if you use php5-mycrypt:
http://mirrors.kernel.org/ubuntu/pool/main/libt/libtool/libltdl3_1.5.26-...
I repackaged php5-fpm for Ubuntu on a launchpad ppa for 3 reasons:
First, I wanted to avoid the extra work for Ubuntu users of manually adding the packages above.
Second, I wanted to have php built with the identical compile options and patches as Ubuntu's current 10.04 php. Guillaume uses the php bundled gd (which is not a bad idea) and also the mysqlnd native driver, whereas Debian and Ubuntu use the official gd and the libmysql driver. There are also several code patches that Ubuntu applies that Guillaume doesn't. I wanted my php-fpm to match the decisions of the Ubuntu packagers.
Ubuntu has updated php5 twice this month to incremental releases php5-5.3.2-1ubuntu4.1 and php5-5.3.2-1ubuntu4.2 and I wanted to be able to track those patches immediately and add them to my php-fpm build.
Third, I wanted the latest version of php-fpm. Guillaume is using the fpm patch from last year that has proved very stable but didn't receive full attention from the fpm originator Andrei Nigmatulin. By the time version 5.3 and 5.2.13 were released, Andrei had already stopped updating his great work. As far as I know, there's no dev maintaining the 5.2.x branch.
Luckily, since then, fpm has been merged into the official php.net development trunk and is now actively maintained by Antony Dovgal and Jerome Loyet, two php.net devs. Jerome has put in some good work bringing in the apache-like dynamic child spawning, and Antony has been committing patches based on reported problems. They've also committed a conversion from an xml conf file to the ini format.
I'm using the very latest svn development version of fpm to get the benefits of the new code and watchful eye of php.net devs.
I completely agree with you about the state of Drupal contrib modules (and core) with respect to 5.3 compatibility. I'm up to nine patches that I have to apply now to core and to contrib modules that I use.
发表评论
-
一分钟学awk够用(产品经理都懂了)
2018-05-10 15:30 7601分钟懂awk-技不在深,够用就行 1.什么是AW ... -
查看Linux是ubuntu还是centos
2018-03-26 10:02 1847[operadmin@testtools devtools] ... -
mac-date命令
2016-09-12 13:30 1813参数解析: -j:使用-j才能使用-f -n:默认情况下 ... -
Linux进度条实现方式
2016-09-10 16:28 1168《《《转载内容》》》》 example1: #!/bi ... -
sed高级用法
2015-04-28 16:50 1028下一个:n命令 $ sed '/t ... -
[Linux]字符处理相关命令
2015-03-23 14:38 825一、tr可以替换或者删除某些文字或者字符,也是一个非常不错的 ... -
[RedHat] RHCE_RHEL6_实战精品 6.postfix邮件服务器
2015-01-30 16:39 1327企业需求: 配置一台dn.ws.com域的邮件服务器, ... -
[linux]vim快捷键
2015-01-06 15:45 16201. 关于Vim vim是我最 ... -
[Linux shell]查找某目录下文件是否包含某个字符串
2014-10-21 14:05 3762查找目录下的所有文件 ... -
[linux]在vi和vim中彩色显示语法
2014-06-10 11:20 1121首先在配置自己的vi环境变量vi ~/.vimrcsyntax ... -
[Linux]Ubuntun与redhatService管理对比
2013-11-14 10:56 958Command Line Tools Below is a ... -
[Linux]Ubuntu与redhat包管理器命令对比
2013-11-14 10:55 2179Below is a table of equivalen ... -
VSS,RSS,PSS,USS
2013-03-28 10:56 8603adb shell procrank | grep com ... -
[linux]sed与awk
2013-03-27 17:55 1142详情见附件,附件是一本书 -
[ubuntu]设置开机自启动程序的方法
2013-01-21 17:45 2045先用gnome-session-properties添加一个程 ... -
[网络性能测试]iperf适用于linux以及windows
2012-10-08 11:32 8236文章引用:http://sharkyan. ... -
【linux shell】推荐一个比较好的博客
2012-05-17 18:17 1297http://blog.chinaunix.net/uid/2 ... -
[linux]磁盘监控程序并且发EMail
2012-05-17 18:00 1273以下代码实现磁盘空间小于10G自动发送邮件 #!/bin ... -
[linux]写的一个服务器数据过滤HTML脚本
2012-05-17 17:56 1317此脚本过滤统计后台数据并显示为HTML格式 # !/bin ... -
[linux]linux过滤日志奇偶数行
2012-05-17 15:48 1753sed -n -e 'n' -e 'p' -i tmp.txt ...
相关推荐
- `php-fpm-5.4.16-42.el7.x86_64.rpm` 是PHP-FPM的具体版本安装包,版本号为5.4.16,适用于Red Hat Enterprise Linux 7(RHEL 7)系统的64位架构。安装这个包后,系统就能支持PHP-FPM服务。 - `php_scripts` 可能是...
在本篇中,我们将深入探讨PHP-FPM的含义、功能以及如何在Linux环境中进行安装和使用。 PHP-FPM是PHP FastCGI的实现,FastCGI是一种用于Web服务器与动态脚本语言之间通信的协议。相比于传统的CGI,FastCGI提供了更...
php-fpm是个中间件,在需要php解释器来处理.php文本时会用到php-fpm。自从php5.3.3以后就将php-fpm集成在php内核中。PHP-FPM提供了更好的PHP进程管理方式,可以有效控制内存和进程、可以平滑重载PHP配置。 作者:...
使用busybox环境和php-fpm封装的docker容器 所以非常小 使用docker load -i php-fpm_7.0.4-image.tar.gz 加载镜像 加载后可以直接使用 最好进入容器中修改配置文件后重启容器使用
docker-compose php7.3.4-fpm+nginx+mysql配置
6. **php-fpm-exporter**:将PHP-FPM状态转换为Prometheus可读格式,以便在Grafana等工具中展示。 在实际操作中,我们可以通过`php-fpm.conf`配置文件调整PHP-FPM的行为,例如设置最大子进程数、平滑重启策略等。...
`php-fpm.conf`是PHP-FPM(FastCGI Process Manager)的主要配置文件,用于管理PHP FastCGI进程。PHP-FPM是PHP的一个扩展,它提供了更高效、...在实际使用中,应根据服务器资源、应用需求以及安全策略进行相应的调整。
在安装Nginx和PHP5-FPM之前,确保系统拥有所有必要的依赖。这可能包括libapache2-mod-php5、php5-cli、php5-common、php5-curl等。运行以下命令: ```bash sudo apt-get install -y libapache2-mod-php5 ...
在本文中,我们将详细探讨如何在Ubuntu 12.04上安装和配置一个基于Nginx、PHP5(通过PHP-FPM)和MySQL的Web服务器环境。这个组合常被称为LEMP堆栈(Linux, Nginx, MySQL, PHP)。下面是每个组件的安装和配置步骤。 ...
在本文中,我们将详细探讨如何在Ubuntu 12.04服务器上安装Nginx、PHP5(通过PHP-FPM)以及MySQL,构建一个高效且可靠的Web服务器环境。这个过程适用于那些希望在Ubuntu上搭建网站或者开发Web应用程序的用户。 首先...
编译源代码时,缺乏顺利开启fpm,于是鼓捣了一下,并打包了一个适用于php5.3.10的 ...上暂时只跟新到 php-5.2.9-fpm-0.5.10-unofficial.diff.gz 编译参数: #./configure --enable-fpm + other custum configure .etc
php-fpm。放到/etc/init.d/目录。然后执行:chmod a+x php-fpm 然后就可以/etc/init.d/php-fpm start 或者systemctl start php-fpm
在HLK-FPM383F指纹识别模块的使用中,我们使用了一些缩写与术语,例如FPM(Fingerprint Module)、SDK(Software Development Kit)、API(Application Programming Interface)等。其中,FPM指的是指纹识别模块,...
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
安装php所需要的文件,没有此文件将安装失败!!!!!安装php所需要的文件,没有此文件将安装失败!!!!!
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
Ubuntu上的Nginx PHP5 FPM重新启动修复 stop: Unknown instance:运行服务php5-fpm后重新启动? 正常。 该脚本解决了Ubuntu-Nginx服务php5-fpm重新启动的问题。 这是一个已知的错误,已重新出现。 如果您运行tail -f ...
正常编译安装 php 按照以前流程,把 init.d.php-fpm 往 /etc/init.d/php-fpm 拷贝 然后准备执行 service php-fpm start 时出错了 错误如下 Failed to start php-fpm.service: Unit php-fpm.service not found. ...
在Fedora 15操作系统上搭建一个完整的Web服务环境,通常包括Nginx(一个高性能的HTTP服务器和反向代理服务器)、PHP-FPM(PHP FastCGI进程管理器)以及MySQL数据库服务。以下是如何在Fedora 15上安装和配置这些组件...
php-fpm-5.3.3-14.el6_3.x86_64.rpm