关于centos8 安装php7.2源码安装 简单笔记

 

yum -y install libxml2 libxml2-devel gd gd-devel
 wget http://cn2.php.net/distributions/php-7.2.0.tar.gz
 tar -zxvf php-7.2.0.tar.gz //解压
 cd php-7.2.0 //切换路径

 

./configure --prefix=/usr/local/php --with-iconv-dir=/usr/local/libiconv --with-config-file-path=/usr/local/php --enable-mbstring --with-openssl --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
make ZEND_EXTRA_LIBS='-liconv'    #重要,不然容易出现报错
make install
cp php.ini-production /usr/local/php/etc/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 sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm    //给执行权限
ln -s /etc/init.d/php-fpm /usr/bin/   //创建软链接

vim /etc/profile

export PATH=/usr/local/php/bin:$PATH       #最后面添加

source /etc/profile //不重启刷新环境变量

 

 

你可能感兴趣的:(操作系统)