php-编译安装教程

php-编译安装教程

一、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 

 

 

 

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
百度已收录
Linux

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: