安装PHP

1、下载源码包程序

# mkdir /tmp/php_build

# cd /tmp/php_build

# wget http://cn2.php.net/distributions/php-7.2.9.tar.xz  ##有其他版本,这是比较老的版本了

 

2、安装依赖

# yum install -y gcc-c++ libxml2-devel libxml2-devel libcurl-devel libcurl-devel openssl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

 

3、创建用户和组

# groupadd -r www

# useradd -s /usr/sbin/nologin -r -M -N www

 

4、编译安装

# tar Jxvf php-7.2.9.tar.xz -C /usr/local/

# cd /usr/local/php-7.2.9

# /configure \

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

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

   --bindir=/usr/local/php-7.2.9/bin \

   --sbindir=/usr/local/php-7.2.9/sbin \

   --enable-fpm \

   --with-fpm-user=www \

   --with-fpm-group=www \

   --enable-mysqlnd \

   --with-mysqli=mysqlnd \

   --with-pdo-mysql=mysqlnd \

   --with-iconv-dir \

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

   --with-jpeg-dir \

   --with-png-dir \

   --with-zlib \

   --with-libxml-dir=/usr \

   --enable-xml \

   --disable-rpath \

   --enable-bcmath \

   --enable-shmop \

   --enable-sysvsem \

   --enable-inline-optimization \

   --with-curl \

   --enable-mbregex \

   --enable-mbstring \

   --with-gd \

   --with-openssl \

   --enable-pcntl \

   --enable-sockets \

   --with-mhash \

   --with-xmlrpc \

   --enable-zip \

   --enable-soap \

   --with-gettext \

   --disable-fileinfo \

   --enable-opcache

 

   # make -j `grep processor /proc/cpuinfo | wc -l`

   # make install  #安装完成后会生成/usr/local/php-7.2.9路径

 #后面根据需要修改PHP监听方式就可以了,一种是sock,一种是端口

 #vim /usr/local/php-7.2.12/etc/php-fpm.d/www.conf 

listen = /usr/local/php-7.2.9/var/run/php-7.2.9.sock
或listen = 0.0.0.0:9000;

   #启动命令路径,执行后会有一个PHP主进程很若干个子进程

   #/usr/local/php-7.2.9/sbin/php-fpm

posted @ 2019-08-09 16:24  christine-ting  阅读(169)  评论(0编辑  收藏  举报