复制代码 代码示例:
tar zxvf openssl-0.9.8l.tar.gz
cd openssl-0.9.8l
./config
make
make install
4、安装apache
复制代码 代码示例:
tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache --with-mysql=/usr/local/mysql --enable-module=so --enable-shared=max --enable-rewrite --with-mpm=worker --enable-ssl=static --with-ssl=/usr/local/ssl
make
make install
把apache添加chkconfig
复制代码 代码示例:
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd
加入下面两行:
复制代码 代码示例:
#chkconfig:345 85 15
#description: Start and stops the Apache HTTP Server.
chmod +x /etc/rc.d/init.d/httpd
chkconfig --add httpd
5、安装GD、libxml、libmcrypt等支持
复制代码 代码示例:
#install Libxml
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2-2.6.31
./configure --prefix=/usr/local/libxml2
make
make install
#install jpeg6
mkdir -pv /usr/local/jpeg6/{,bin,lib,
include,man/man1,man1}
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure --prefix=/usr/local/jpeg6 --enable-shared --enable-static
make
make install
#install freetype
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local/freetype
make
make install
#install zlib
tar zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib
make
make install
#install libpng
tar zxvf libpng-1.2.40.tar.gz
cd libpng-1.2.40
cp scripts/makefile.std makefile
make
make install
#install gd
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35
./configure --prefix=/usr/local/gd --with-png=/usr/local/libpng --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6 --with-libxml=/usr/local/libxml2
make
make install
#install libmcrypt
tar zxvf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make
make install
6、安装PHP
复制代码 代码示例:
tar zxvf php-5.2.17.tar.gz
cd php-5.2.17
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd/ --with-jpeg-dir=/usr/local/jpeg6/ --with-zlib-dir=/usr/local/zlib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --with-mysql=/usr/local/mysql --with-mcrypt=/usr/local/lib/libmcrypt --enable-mbstring --with-openssl --enable-ftp --with-curl --enable-sockets
make
make install
cp php.ini-dist /usr/local/php/lib/php.ini
7、配置apache与PHP关联
vi /usr/local/apache/conf/httpd.conf
红色为插入,蓝色为修改
复制代码 代码示例:
……
User
www
Group
www
……
<IfModule dir_module>
DirectoryIndex index.html
index.php
</IfModule>
……
AddType application/x-compress .Z
AddType application/x-
gzip .gz .tgz
AddType application/x-httpd-php .php .html .htm
8、最后启动服务
复制代码 代码示例:
service httpd start