文章目录
- 安装php
- ftp扩展
- 查看扩展是否安装成功
- php-fpm多实例(nginx+php-fpm)
安装php
cd /usr/local/src/php-5.6.35/ext/ftp/
/usr/local/php56/bin/phpize
./configure --with-php-config=/usr/local/php56/bin/php-config
echo $?
make
echo $?
make install
ftp扩展
vim /usr/local/php56/etc/php.ini
extension=/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/ftp.so
然后重启
查看扩展是否安装成功
/usr/local/php56/bin/php -m
php-fpm多实例(nginx+php-fpm)
1.先把php-fpm停掉
2.进入php-fpm的配置文件
cd /usr/local/php56/etc/
复制php-fpm的配置文件
例:php-fpm.conf进行复制
php-fpm1.conf php-fpm2.conf php-fpm3.conf php-fpm4.conf php-fpm5.conf php-fpm6.conf php-fpm7.conf
进入到php-fpm1.conf中进行修改 vim php-fpm1
[global]pid = /usr/local/php56/var/run/php-fpm.piderror_log = /usr/local/php56/var/log/php-fpm.log[www]security.limit_extensions =.php .html .js .css .jpg .jpeg .gif .png .htm .icolisten = /tmp/php1-fcgi.sock # (后续的1、2、3、4、5、6、7都进去把这里修改了)listen.owner=nginxlisten.group=nginxlisten.mode=0666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024
3.进入nginx的配置文件中,本文这是nginx虚拟配置文件
/usr/local/nginx/conf/conf.d/进行修改
vim vhost_as.conf
增加一个代理
upstream php-fpm {server unix:/tmp/php-fcgi.sock;server unix:/tmp/php1-fcgi.sock;server unix:/tmp/php2-fcgi.sock;server unix:/tmp/php3-fcgi.sock;server unix:/tmp/php4-fcgi.sock;server unix:/tmp/php5-fcgi.sock;server unix:/tmp/php6-fcgi.sock;server unix:/tmp/php7-fcgi.sock;}# 然后在下边的server里的location里边#fastcgi_pass unix:/tmp/php-fcgi.sock; 注释掉fastcgi_pass php-fpm; 增加的
4.重新启动nginx
5.启动php-fpm多实例
/usr/local/php56/sbin/php-fpm -y /usr/local/php56/etc/php-fpm.conf
/usr/local/php56/sbin/php-fpm -y /usr/local/php56/etc/php-fpm1.conf
/usr/local/php56/sbin/php-fpm -y /usr/local/php56/etc/php-fpm2.conf
....
# 以此类推