Linux 搭建PHP7

Linux中必备常用支持库的安装(CentOS-*)

在CentOS安装软件的时候,可能缺少一部分支持库,而报错。这里首先安装系统常用的支持库。那么在安装的时候就会减少很多的错误的出现。

# yum install -y gcc gdb strace gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs patch e2fsprogs-devel krb5-devel libidn libidn-devel openldap-devel nss_ldap openldap-clients openldap-servers libevent-devel libevent uuid-devel uuid mysql-devel

1、下载php-7.2.1

#    wget  http://am1.php.net/get/php-7.2.1.tar.gz/from/this/mirror

一、安装相关的依赖:

#    yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel

#    yum -y install curl-devel

#    yum -y install libxslt-devel

#    yum install openssl openssl-devel

二,解压安装

#    tar -zxvf php-7.2.1.tar.gz

#    cd php-7.2.1

#    ./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip

#    make

#    make install

三,配置文件(cdphp-7.2.1)

#    cp php.ini-development /usr/local/php/lib/php.ini

#    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

#    cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

#    cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm

需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置

启动php-fpm

#    /etc/init.d/php-fpm

查询php-fpm进程

#    ps aux | grep php-fpm

杀掉php-fpm进程

#    kill pid

你可能感兴趣的:(Linux 搭建PHP7)