废话 不多说,直接上操作
sudo yum install gcc libxml2 libxml2-devel zlib zlib-devel \
openssl openssl-devel libcurl-devel \
gd libjpeg libjpeg-devel libpng libpng-devel
./configure --prefix=/usr/local/php --enable-fpm \
--enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
--with-openssl --with-curl \
--with-gd --enable-gd-native-ttf --enable-mbstring
make
sudo make install
sudo cp ./php.ini-development /usr/local/php/lib/php.ini
sudo mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
sudo mv /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
编译安装libxml2出现
libxml.c:3909: error: ‘PyObject’ undeclared (first use in this function)
libxml.c:3909: error: ‘module’ undeclared (first use in this function)
libxml.c:3915: warning: implicit declaration of function ‘Py_InitModule’
libxml.c:3915: warning: nested extern declaration of ‘Py_InitModule’
libxml.c:3915: error: ‘libxmlMethods’ undeclared (first use in this function)
make[4]: * [libxml.lo] Error 1
需要安装
yum -y install python-devel
./configure --prefix=/usr/local/php --enable-fpm --with-libxml-dir=/usr/local/libxml2
//推荐加上openssl,curl等参数
--with-openssl
--with-curl
--enable-mysqlnd
--with-mysqli=mysqlnd