php7编译安装与php5共存
程序员文章站
2022-05-06 19:33:39
...
1.下载
wget http://php.net/get/php-7.0.5.tar.gz/from/a/mirror
2.解压
tar zxvf php-7.0.5.tar.gzcd php-7.0.5
3.安装,由于原本5.5安装在 /usr/local/php 下面,所以新版的php7 我就安装到 /usr/local/php7 了
./configure --prefix=/usr/local/php7 \ --with-curl \ --with-freetype-dir \ --with-gd \ --with-gettext \ --with-iconv-dir \ --with-kerberos \ --with-libdir=lib64 \ --with-libxml-dir \ --with-mysqli \ --with-openssl \ --with-pcre-regex \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --with-png-dir \ --with-xmlrpc \ --with-xsl \ --with-zlib \ --enable-fpm \ --enable-bcmath \ --enable-libxml \ --enable-inline-optimization \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-xml \ --enable-zip
4.配置
cp php.ini-production /usr/local/php7/etc/php.inicp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.confcp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.confcp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm7
5.出现错误
xsl 相关错误
现象:configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决办法:yum install -y libxslt libxslt-devel libxml2 libxml2-devel
make错误: make: *** [sapi/cli/php] error 1
解决办法:make ZEND_EXTRA_LIBS='-liconv'