SUSE LINUX 安装Apache2 + PHP5 (普通安装,不是yum)

时间:2024-11-13 19:10:36

1.安装JPEG6 jpegsrc.

# mkdir -p /usr/local/services/jpeg6 
# mkdir -p /usr/local/services/jpeg6/bin 
# mkdir -p /usr/local/services/jpeg6/lib 
# mkdir -p /usr/local/services/jpeg6/include 
# mkdir -p /usr/local/services/jpeg6/man 
# mkdir -p /usr/local/services/jpeg6/man1
# mkdir -p /usr/local/services/jpeg6/man/man1

# tar -zvxf jpegsrc.
# CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/services/jpeg6/ --enable-shared --enable-static
# make
# make install

 

问题:jpeg6 make: ./libtool:命令未找到

解决:拷贝libtool文件到jpeg6安装文件目录

问题:x86_64-unknown-linux-gnu

解决:拷贝libtool文件到jpeg6文件目录(注意是安装包目录)

 

2.安装LIBpng libpng-1.2.

# tar -zvxf libpng-1.2.
# cd libpng-1.2.8
# cp scripts/ makefile 
# vi makefile

在CFLAGS加入-fPIC

 

# make
# make install 

3.安装Freetype freetype-2.4.

# tar -zvxf freetype-2.4. 
# cd freetype-2.4.4
# ./configure --prefix=/usr/local/services/freetype 
# make
# make install

 

问题:make: Nothing to be done for `unix'.忽略

4.安装Zlib zlib-1.2.

# tar -zxvf zlib-1.2.
# ./configure --prefix=/usr/local/services/zlib/
# make
# make install

问题:zlib/lib/: could not read symbols: Bad value

解决:在CFLAGS加入 -fPIC

5.安装GD GD-2.0.

# tar -zxvf GD-2.0.
# ./configure --prefix=/usr/local/services/gd2/ --with-jpeg=/usr/local/services/jpeg6/ --with-png=/usr/local/services/lib/ --with-zlib=/usr/local/services/zlib --with-freetype=/usr/local/services/freetype

显示

Configuration summary for gd 2.0.33:
   Support for PNG library:          yes
   Support for JPEG library:         yes
   Support for Freetype  library: yes
   Support for Fontconfig library:   no
   Support for Xpm library:          no
   Support for pthreads:             yes
# make
# make install

 

错误:/lib/(): could not read symbols: Bad value

解决:安装jpeg6的时候,加上CFLAGS="-O3 -fPIC"参数

6.安装Curl curl-7.19.

# tar -zxvf curl-7.19.
# ./configure --prefix=/usr/local/services/curl
# make
# make install

7.安装Libxml libxml2-2.7.

# tar -zxvf libxml2-2.7.
# ./configure --prefix=/usr/local/services/libxml2 --with-zlib=/usr/local/services/zlib/
# make
# make install

问题:“bin/rm: cannot remove `libtoolT': No such file or directory”
解决:

# aclocal
# autoconf
# automake
# libtoolize --force

问题:./.libs/: undefined reference to `gzopen64' 
解决:vi编辑Makefile文件,然后在CFLAGS后面添加 -fPIC 参数

8.安装PHP php-5.3.

# tar -zxvf php-5.3.
#  ./configure --prefix=/usr/local/services/php/ --with-apxs2=/usr/local/services/apache2/bin/apxs --with-libxml-dir=/usr/local/services/libxml2/ --with-gd=/usr/local/services/gd2/ --with-jpeg-dir=/usr/local/services/jpeg6/ --with-zlib-dir=/usr/local/services/zlib/ --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/services/freetype/ --with-curl=/usr/local/services/curl --enable-ftp 
A.拷贝配置文件
# cp -production /usr/local/services/php/lib/
B.修改Apache2配置

在AddType application/x-gzip .gz .tgz 插入如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

C.创建测试文件,扩展名PHP
<?php
phpinfo();
?>
D.重启Apache
#/usr/local/services/apache2/bin/apachectl restart