提前安装准备
yum groupinstall "development tools"
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl curl-devel openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
Config 配置
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-fpm --with-curl --with-openssl --enable-mbregex --with-mysql --with-mysqli --with-mysql-sock --enable-pdo --with-pdo-mysql --with-pdo-sqlite --enable-mysqlnd --with-gd --enable-gd-native-ttf --enable-exif --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir=/usr/local/freetype --enable-gd-jis-conv --with-gettext --with-zlib --enable-zip --with-bz2 --disable-fileinfo --enable-xmlreader --enable-xmlwriter --with-xmlrpc --enable-mbstring --enable-inline-optimization
复制配置文件
cp php.ini-development /usr/local/php/lib/php.ini
date.timezone =Asia/Shanghai
出现的问题 php安装 出现Sorry, I cannot run apxs. ***错误解决方法
打开Apache的apxs 文件
讲第一行文件 #!/replace/with/path/to/perl/interpreter -w
替换成 #!/usr/bin/perl -w
保存继续编译即可
Timezone Asia/Shanghai
以上就介绍了 CentOS 编译安装php56,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。