ubuntu14.04 compile and install php5.5.38

1, the installation editing tools

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

2, download source, extract into the source directory (Download: https://www.php.net/releases/  , search 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, ready to php-fpm startup files and configuration files php-fpm.conf

cd php-5.5.38

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

cp cow / 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, edit the configuration file php.ini the timezone

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

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

date.timezone = PRC

6, edit the configuration-file fpm.conf PHP
[the 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, php modified version of nginx php configuration file to specify port 9002 of fastcgi_pass selected running
[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 / test admin;

  #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, start php5.5-fpm and nginx

service php5.5-fpm start

service nginx reload 

Published 44 original articles · won praise 28 · views 420 000 +

Guess you like

Origin blog.csdn.net/hanzengyi/article/details/100324261