开源社区

php-编译安装教程

Linux · 3月7日 · 2020年

php下地址,下载到/servcer/scripts

wget https://www.php.net/distributions/php-7.2.28.tar.gz
wget  https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz

二、php编译相关插件依赖安装

   yum install -y zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel openssl openssl-devel
   rpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

切换目录libiconv-1.16

cd /server/scripts/libiconv-1.16 
   ./configure --prefix=/usr/local/libiconv
   make
   make install

四、编译php

  ./configure \
   --prefix=/usr/local/php-7.2.28 \
   --with-mysql=mysqld \
   --with-pdo-mysql=mysqlnd \
   --with-iconv-dir=/usr/local/libiconv \
   --with-freetype-dir \
   --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-fpm \
   --enable-mbstring \
   --with-mcrypt \
   --with-gd \
   --enable-gd-native-ttf \
   --with-openssl \
   --with-mhash \
   --enable-pcntl \
   --enable-sockets \
   --with-xmlrpc \
   --enable-soap \
   --enable-short-tags \
   --enable-static \
   --with-xsl \
   --with-fpm-user=www \
   --with-fpm-group=www \
   --enable-ftp \
   --enable-opcache=no 

五、编前防错方法(以下信息可以不行配置了)

[root@localhost scripts]# ln -s mysql-5.7.22-linux-glibc2.12-x86_64/lib/libmysqlclient.so.20 /usr/lib64/
[root@localhost ]#cd /server/scripts/php-7.2.28
[root@localhost php-7.2.28]# touch ext/phar/phar.phar
[root@localhost etc]#cd /usr/local/php-7.2.28/etc
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf

、创建虚拟

[root@localhost php-7.2.28]# useradd -s /sbin/nologin www

、启动报错

[07-Mar-2020 18:27:45] WARNING: Nothing matches the include pattern '/usr/local/php-7.2.28/etc/php-fpm.d/*.conf' from /usr/local/php-7.2.28/etc/php-fpm.conf at line 125.
[07-Mar-2020 18:27:45] ERROR: No pool defined. at least one pool section must be specified in config file
[07-Mar-2020 18:27:45] ERROR: failed to post process the configuration
[07-Mar-2020 18:27:45] ERROR: FPM initialization failed

决办法:

[root@localhost ]cd /usr/local/php-7.2.28/etc/php-fpm.d
[root@localhost php-fpm.d]# cp www.conf.default www.conf

 

八、

[root@localhost php-fpm.d]# /usr/local/php-7.2.28/sbin/php-fpm 

 

 

 

0 条回应