1、下载源码包
wget 网址/php-5.4.45.tar
2、解压源码包
tar -zxvf php-5.4.45.tar
3、创建一个安装目录
mkdir /usr/local/php
4、进入解压后的目录中,初始化安装环境:
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-libxml-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--with-zlib-dir \
--with-bz2 \
--with-openssl \
--with-mcrypt \
--enable-soap \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-sockets \
--enable-exif \
--disable-ipv6
错误
configure: error: jpeglib.h not found.
[[email protected] php-5.4.45]#
安装 yum install -y libjpeg-devel
错误
configure: error: mcrypt.h not found. Please
reinstall libmcrypt.
[[email protected] php-5.4.45]#
安装yum install -y epel-release libmcrypt-devel
5、编绎:make
6、安装:make install
/usr/local/php/bin/php -i 查看相关的配置