手记

Linux下安装PHP

CentOS6.5下安装PHP

1、依旧是进入/usr/local/src目录下并下载PHP安装包

[root@localhost ~]# cd /usr/local/src/

[root@localhost src]# wget http://am1.php.net/distributions/php-5.3.27.tar.gz


2、解压

[root@localhost src]# tar zxf php-5.3.27.tar.gz


3、配置并编译参数

[root@localhost src]# cd php-5.3.27

在编译参数前先下载一下库文件:

[root@localhost php-5.3.27]# yum install -y libxml2-devel

[root@localhost php-5.3.27]# yum install -y openssl openssl-devel

[root@localhost php-5.3.27]# yum install -y bzip2 bzip2-devel

[root@localhost php-5.3.27]# yum install -y freetype freetype-devel

[root@localhost php-5.3.27]# yum install -y libpng libpng-devel

若还缺少哪些库文件只需按提示用yum下载即可


[root@localhost php-5.3.27]# ./configure \

> --prefix=/usr/local/php \

> --with-apxs2=/usr/local/apache2/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

出现下面这个则配置成功:

4、编译

[root@localhost php-5.3.27]#make


5、安装

[root@localhost php-5.3.27]#make install


完事!


0人推荐
随时随地看视频
慕课网APP