Home > Backend Development > PHP Tutorial > 1.8LNMP环境编译安装php-5.6.14

1.8LNMP环境编译安装php-5.6.14

WBOY
Release: 2016-06-20 12:42:32
Original
1069 people have browsed it

一、解压php

[root@www src]# tar jxf php-5.6.14.tar.bz2 

[root@www src]# cd php-5.6.14


二、创建PHP相关用户

[root@www php-5.6.14]# useradd -s /sbin/nologin php-fpm


三、编译安装php

[root@www php-5.6.14]# ./configure \

> --prefix=/usr/local/php \

> --with-config-file-path=/usr/local/php/etc \

> --enable-fpm \

> --with-fpm-user=php-fpm \

> --with-fpm-group=php-fpm \

> --with-mysql=/usr/local/mysql \

> --with-mysql-sock=/var/lib/mysql/mysql.sock \

> --with-mysqli=/usr/local/mysql/bin/mysql_config \

> --with-freetype-dir=/usr/local/freetype \

> --with-jpeg-dir=/usr/local/jpeg6 \

> --with-mcrypt=/usr/local/libmcrypt \

> --with-gd=/usr/local/libgd2 \

> --with-iconv-dir=/usr/local/libiconv \

> --with-png-dir \

> --with-zlib \

> --with-libxml-dir \

> --with-curl \

> --with-mhash \

> --with-openssl \

> --with-pear \

> --enable-soap \

> --enable-gd-native-ttf \

> --enable-ftp \

> --enable-mbstring \

> --enable-exif \

> --enable-zend-multibyte \

> --disable-ipv6 \

> --enable-bcmath \

> --enable-shmop \

> --enable-sysvsem \

> --with-pcre-dir


configure: WARNING: unrecognized options: --enable-zend-multibyte (不支持的参数)


[root@www php-5.6.14]# make && make install

[root@www php-5.6.14]# ls /usr/local/php/

bin  etc  include  lib  php  sbin  var


1、复制php主配置文件

[root@www php-5.6.14]# cp php.ini-production /usr/local/php/etc/php.ini


2、复制启动脚本

[root@www php-5.6.14]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

[root@www php-5.6.14]# chmod 755 /etc/init.d/php-fpm 

[root@www php-5.6.14]# chkconfig --add php-fpm

[root@www php-5.6.14]# chkconfig php-fpm on


3、拷贝php-fpm配置文件

[root@www php-5.6.14]# mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

[root@www php-5.6.14]# ls /usr/local/php/etc/

pear.conf  php-fpm.conf  php.ini


4、检查配置错误

[root@www php-5.6.14]# /usr/local/php/sbin/php-fpm -t

[16-Dec-2015 14:16:26] NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful


5、启动php-fpm

[root@www php-5.6.14]# service php-fpm start

Starting php-fpm  done


6、查看进程

[root@www php-5.6.14]# ps aux | grep php-fpm

root      16922  0.0  0.4 129188  4988 ?        Ss   14:17   0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)                                                                    

php-fpm   16923  0.0  0.4 129188  4636 ?        S    14:17   0:00 php-fpm: pool www                                                                                                            

php-fpm   16924  0.0  0.4 129188  4636 ?        S    14:17   0:00 php-fpm: pool www                                                                                                            

root      16927  0.0  0.0 103248   876 pts/0    S+   14:18   0:00 grep php-fpm


7、查看监听端口

[root@www php-5.6.14]# netstat -nltp | grep php-fpm

tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      16922/php-fpm       



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