一、下载phpphp-5.4.4
[[email protected] software]# pwd
/software
[[email protected] software]# wget http://mirrors.sohu.com/php/php-5.4.44.tar.gz
二、解压php-5.4.44.tar.gz
[[email protected] software]# tar -xzvf php-5.4.44.tar.gz
三、./configure make make install
[[email protected] php-5.4.44]# pwd
/software/php-5.4.44
[[email protected] php-5.4.44]# ./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-mysqli=/usr/local/mysql/bin/mysql_config --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 --with-curl --with-openssl --with-zlib-dir --enable-ftp
make
make install
四、源码安装 Apache+PHP 整合
整合 apache+php 环境,修改 httpd.conf 配置文件,然后加入如下语句:
LoadModule php5_module modules/libphp5.so (默认已存在)
AddType application/x-httpd-php .php
DirectoryIndex index.php index.html (把 index.php 加入 index.html 之前)
五、然后在/usr/local/apache/htdocs 目录下创建 index.php 测试页面,执行如下 命令:
cat >>/usr/local/apache/htdocs/index.php < EOF
重新启动 apache 服务,通过 IP 访问界面如下图,即代表 LAMP 环境搭建成功。