suse10 64位机器安装
php指南
参考原文地址:http://wenku.baidu.com/view/da410d146edb6f1aff001f7c.html
#组件;apache,
php,mysql,gd2
一、安装mysql
通过凯莉系统安装(http://db.ied.com)
注意:编译
php时使用的mysql路径是凯莉默认安装的路径,如果自行安装的mysql,要修改编译
php对应的mysql路径。
二、安装apache
mkdir /usr/local/apache2
cd ${MainPath};tar -zxf httpd-2.2.21.tar.gz
cd httpd-2.2.21/
./configure --prefix=/usr/local/apache2 --enable-module=so --enable-rewrite
make
make install
make clean
三、安装libxml2
mkdir -p /usr/local/modules/libxml
cd ${MainPath};tar -zxf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8/
./configure --prefix=/usr/local/modules/libxml
make
make install
make clean
cp /usr/local/modules/libxml/bin/xml2-config /usr/bin/xml2-config
四、安装zlib
mkdir /usr/local/modules/zlib
cd ${MainPath};tar -zxf zlib-1.2.5.tar.gz
cd zlib-1.2.5/
./configure --prefix=/usr/local/modules/zlib
make
make install
make clean
五、安装jpeg
mkdir -p /usr/local/modules/jpeg
mkdir -p /usr/local/modules/jpeg/bin
mkdir -p /usr/local/modules/jpeg/lib
mkdir -p /usr/local/modules/jpeg/include
mkdir -p /usr/local/modules/jpeg/man
mkdir -p /usr/local/modules/jpeg/man1
mkdir -p /usr/local/modules/jpeg/man/man1
cd ${MainPath};tar -zxf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/usr/local/modules/jpeg --enable-shared --enable-static
如果你的机器是64位,并且在安装gd时候出现下面错误:
/usr/bin/ld: /server/apache2/modlib/jpeg6//lib/libjpeg.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
/server/apache2/modlib/jpeg6//lib/libjpeg.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [libgd.la] Error 1
修补办法(接上面步骤):
vi Makefile
找到 CFLAGS= -O2 -I$(srcdir)
在后面加入-fPIC,即变成CFLAGS= -O2 -I$(srcdir) -fPIC(configure后改),然后继续:
cp /usr/bin/libtool ./
make
make install-lib
make install
make clean
六、安装libpng
mkdir /usr/local/modules/libpng
cd ${MainPath};tar -zxf libpng-1.5.4.tar.gz
cd libpng-1.5.4/
./configure --prefix=/usr/local/modules/libpng
make
make install
make clean
七、安装freetype
mkdir /usr/local/modules/freetype
cd ${MainPath};tar -zxf freetype-2.4.6.tar.gz
cd freetype-2.4.6/
./configure --prefix=/usr/local/modules/freetype
make
make install
make clean
八、安装gd2
mkdir /usr/local/modules/gd2
cd ${MainPath};tar -zxf gd-2.0.35.tar.gz
cd gd/2.0.35/
chmod 640 gd_png.c
vi gd_png.c
将
#include "png.h"修改为
#include "/usr/local/modules/libpng/include/png.h"(注意是libpng路径)
./configure --prefix=/usr/local/modules/gd2 --with-zlib=/usr/local/modules/zlib/ --with-png=/usr/local/modules/libpng/ --with-jpeg=/usr/local/modules/jpeg/ --with-xml2=/usr/local/modules/libxml/ --with-freetype=/usr/local/modules/freetype/
make
make install
make clean
九、安装
php5
mkdir /usr/local/
php5
cd ${MainPath};tar -zxf
php-5.3.8.tar.gz
cd
php-5.3.8/
./configure --prefix=/usr/local/
php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/modules/jpeg/ --with-png-dir=/usr/local/modules/libpng/ --with-libxml-dir=/usr/local/modules/libxml/ --with-gd=/usr/local/modules/gd2/ --with-freetype-dir=/usr/local/modules/freetype/ --with-zlib-dir=/usr/local/modules/zlib/ --with-mysql=/usr/local/mysql --enable-soap --enable-sockets --enable-mbstring --enable-gd-native-ttf --enable-calendar --with-config-file-path=/usr/local/
php5/etc/
make
make install
make clean
如果在安装
php时出现relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC
则在configure后 zlib的文件夹中的MakeFile 文件中修改 在gcc后面加上 -fPIC
重新编绎 zlib后再统绎gd2 再编译
php
十、安装后的配置
/usr/local/
php5/etc/
php.ini
/usr/local/apache2/conf/httpd.conf
到这一步,安装配置已经全部完成!