ubuntu14.04编译安装php5.5.38

1、 安装编辑工具

sudo apt install libxml2-dev openssl libjpeg-dev libpng-dev libcurl4-openssl-dev pkg-config libmcrypt-dev

2、下载源码,解压进入源码目录(下载地址:https://www.php.net/releases/ ,搜索5.5.38 )

wget https://www.php.net/distributions/php-5.5.38.tar.gz

tar zxf php-5.5.38.tar.gz

cd php-5.5.38

./configure --prefix=/usr/local/php5.6 --with-config-file-path=/usr/local/php5.6/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-config-file-scan-dir=/usr/local/php5.6/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --with-gettext --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-mbstring --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-gd --with-zlib --enable-zip --with-pear

3、make && make install

4、准备php-fpm启动文件和php-fpm.conf配置文件

cd php-5.5.38

cp php.ini-production /usr/local/php5.5/etc/php.ini

cp sapi/fpm/init.d.php-fpm /etc/init.d/php5.5-fpm

chmod +x /etc/init.d/php5.5-fpm

cd /usr/local/php5.5/etc/

cp /usr/local/php5.5/etc/php-fpm.conf.default php-fpm.conf

 

5、编辑配置文件php.ini的timezone

vi /usr/local/php5.5/etc/php.ini

; http://php.net/date.timezone

date.timezone = PRC

6、编辑配置文件php-fpm.conf
[root@localhost php-5.5.38]# cat/usr/local/php5.5/etc/php-fpm.conf

[global]

pid = /usr/local/php5.5/var/run/php-fpm.pid

error_log = /usr/local/php5.5/var/log/php-fpm.log

log_level =warning

[www]

listen = 127.0.0.1:9002

listen.backlog = -1

listen.allowed_clients = 127.0.0.1

listen.owner = www

listen.group = www

listen.mode = 0666

user = www

group = www

pm = dynamic

pm.max_children = 100

pm.start_servers = 50

pm.min_spare_servers = 30

pm.max_spare_servers =  80

request_terminate_timeout = 0

request_slowlog_timeout = 0

slowlog = var/log/slow.log

7、修改nginx配置文件指定php的fastcgi_pass端口9002选定运行的php版本
[root@localhost php-5.5.38]# cat/usr/local/nginx/conf/vhost/testadmin.conf

  server

 {

  listen       80;

  server_name testadmin.com;

   indexindex.html index.php;

   root  /data/www/testadmin;

  #limit_conn   crawler  20;   

  #error_page 404

   location ~ .*\.(php|php5)?$

   {

    #fastcgi_pass unix:/tmp/php-cgi.sock;

    fastcgi_pass  127.0.0.1:9002;

    fastcgi_index index.php;

     includefastcgi.conf;          

   }

   location ~.*\.(gif|jpg|jpeg|png|bmp|swf)$

   {

    expires      30d;

   } 

   location ~.*\.(js|css)?$

   {

    expires      1h;

   }

   location/5998153NginxStatus

   {

    stub_status on;

    access_log   off;

   }

   #access_log  /dev/null;

  error_log /data/wwwlogs/error.log;

 }

nginx -t

nginx: the configuration file/usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file/usr/local/nginx/conf/nginx.conf test is successful

8、启动php5.5-fpm和nginx

service php5.5-fpm start

service nginx reload 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值