图-LAMP
LAMP平台环境的构建的一件不太容易的事情,过程比较繁琐,跟好文章的脚步往下看!
3.安装PHP-5.2.9
软件获取:http://www.php.net/downloads.php
安装php之前先要安装:
zlib-1.2.3软件获取:http://www.zlib.net
tar xvfz zlib-1.2.3.tar.gz
cd zlib-1.2.3.tar.gz
./configure –prefix=/usr/local/zlib
make
make install
freetype-2.3.9软件获取:http://sourceforge.net/projects/freetype/files/
tar xvfz freetype-2.3.9.tar.gz
cd freetype-2.3.9
./configure –prefix=/usr/local/freetype2
make
make install
libpng-1.2.38软件获取:http://sourceforge.net/projects/libpng/files/
tar xvfz libpng-1.2.7.tar.gz
cd libpng-1.2.38
./configure –prefix=/usr/local/libpng
make
make install
libxml2-2.7.3软件获取:
tar zxf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3.tar.gz
./configure –prefix=/usr/local/libxml2
make
make install
jpeg-7软件获取:http://www.ijg.org
tar xvfz jpegsrc.v7.tar.gz
cd jpeg-7/
mkdir -p /usr/local/jpeg7
mkdir -p /usr/local/jpeg7/bin
mkdir -p /usr/local/jpeg7/lib
mkdir -p /usr/local/jpeg7/include
mkdir -p /usr/local/jpeg7/man
mkdir -p /usr/local/jpeg7/man/man1
./configure –prefiex=/usr/local/jpeg7 \
–enable-shared \
–enable-static
make
make test
make install
gd-2.0.35软件获取:http://www.libgd.org/Downloads
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
vim gd_png.c
将#include “png.h”改为:
#include “/usr/local/libpng/include/png.h”
./configure –prefix=/usr/local/gd2 \
–with-png=/usr/local/libpng \
–with-freetype=/usr/local/freetype2 \
–with-jpeg=/usr/local/jpeg7
#p#
make
make install
安装步骤:
tar xvfz php-5.2.9.tar.gz
cd php-5.2.9
./configure \
–prefix=/usr/local/php5 \
–with-apxs2=/usr/local/apache2/bin/apxs \
–with-mysql=/usr/local/mysql \
–with-libxml-dir=/usr/local/libxml2 \
–with-zlib=/usr/local/zlib \
–with-freetype-dir=/usr/local/freetype2 \
–with-png-dir=/usr/local/libpng \
–with-jpeg-dir=/usr/local/jpeg7 \
–with-gd=/usr/local/gd2 \
–enable-sockets \
–enable-ftp \
–enable-calendar
make
make test
make install
cp php.ini-dist /usr/local/php5/lib/php.ini
vim /usr/local/php5/lib/php.ini修改
register_globals = On
将#extension=php_mysql.dll前面的#去掉
修改;data.timezone =为data.timezone = Asia/Shanghai
重新配置apache2让它支持php:
vim /etc/httpd/httpd.conf
查找
在此范围内添加:
AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps
启动apache:
/usr/local/apache2/bin/apachectl start
在/usr/local/apache2/htdocs目录里建一个php测试页info.php,内容如下 :
phpinfo();
?>
用浏览器查看http://localhost/info.php正常的话可以看到php的信息。
通过文章的介绍,我们懂得了如何搭建自己的LAMP平台,希望对你们有用!
【编辑推荐】