2014年7月1日 星期二

手動安裝apache+php

在2014的年中,因為客戶的需求需要很舊版的Apache+PHP+Mysql Client

使用yum 安裝只裝的到新版本因此必須手動安裝

OS: CentOS

首先要先把基本的工具跟Library裝好
部分Library 會有太新的問題<就必須抓舊版的回來裝
gcc
autoconf
freetype-devel.x86_64
zlib-devel.x86_64
libxml2-devel
gd-devel.x86_64
libjpeg-turbo-devel.x86_64
libpng-devel.x86_64
libmcrypt-devel.x86_64
libtool-ltdl-devel
mysql mysql-devel mysql-lib

#新作業系統都是64 library需要指定一下
# ln -s /usr/include /opt/include
# ln -s /usr/lib64 /opt/lib

#太舊的PHP不支援openssl 1.x.x 要手動裝
openssl 0.9.8
./config --prefix=/usr/local/openssl
make install_sw  # 不安裝說明文件

apache2
/configure --prefix=/usr/local/apache2 --enable-ssl --enable-so --with-ssl=/usr/local/openssl

php5
./configure --prefix=/usr/local/php5 --with-mysql=/opt  --with-gd=/opt --with-jpeg-dir=/opt --with-png-dir=/opt --with-libxml-dir=/usr/local/libxml2/ --with-zlib-dir=/opt --with-mcrypt=/opt --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --with-mysqli

#修改啟動稿
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
vi /etc/rc.d/init.d/httpd
在 #!/bin/sh 下面加入以下兩行
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Server

設定啟動狀態
chkconfig --add httpd
chkconfig httpd on