实验环境如下:
Centos6.0(64位) +httpd2.2.19+mysql5.5.12+php5.3.6
编译安装前需要确保如下软件已安装gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*
[root@localhost src]# tar -zxvf cmake-2.8.4.tar.gz
[root@localhost src]# cd cmake-2.8.4
[root@localhost src]# ./configure && make && make install
[root@localhost src]# tar -zxvf mysql-5.5.12.tar.gz
[root@localhost src]# cd mysql-5.5.12
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DMYSQL_TCP_PORT=3306 \
-DMYSQL_USER=mysql
[root@localhost src]# make && make install
初始化数据库,没有错误就说明初始化成功
使用service启动服务,并设置开机启动
[root@localhost mysql-5.5.12]# mysqladmin -u root passworf '123'
[root@localhost src]# tar -zxvf httpd-2.2.19.tar.gz
[root@localhost httpd-2.2.19]# ./configure --prefix=/usr/local/apache2 --enable-ssl --enable-modules --enable-so --enable-rewrite
[root@localhost httpd-2.2.19]# make && make install
设置为开机启动,在rc.local里面直接添加上去就OK
[root@localhost httpd-2.2.19]# vi /etc/rc.local
1. 编译php5.3.6
php 相关模块
yum -y install libjpeg-devel libpng-devel freetype-devel libxml2-devel libxslt-devel zlib-devel curl-devel mhash-devel openldap-devel gd-devel
[root@localhost src]# tar -zxvf libiconv-1.13.1.tar.gz
[root@localhost src]# cd libiconv-1.13.1
[root@localhost libiconv-1.13.1]# ./configure --prefix=/usr/local/libiconv && make && make install
[root@localhost src]# tar -zxvf libmcrypt-2.5.8.tar.gz
[root@localhost src]# cd libmcrypt-2.5.8
[root@localhost libmcrypt-2.5.8]# ./configure && make && make install
[root@localhost libmcrypt-2.5.8]# cd libltdl/
[root@localhost libltdl]# ./configure --enable-ltdl-install && make && make install
[root@localhost libltdl]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
[root@localhost src]# tar -zxvf php-5.3.6.tar.gz
[root@localhost php-5.3.6]#./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-curl --with-curlwrappers --with-mhash --with-mcrypt --with-gd --enable-gd-native-ttf --with-xsl --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear --enable-zip --enable-soap --enable-mbstring --enable-ftp --enable-sockets --enable-pcntl --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --disable-rpath --enable-mbregex --with-apxs2=/usr/local/apache2/bin/apxs
碰到错误configure: error: libjpeg.(a|so) not found
[root@localhost php-5.3.6]# make && make install
修改apache配置文件
[root@localhost php-5.3.6]# vi /usr/local/apache2/conf/httpd.conf
编译安装时候,指定了配置文件目录,需要先创建目录,才能复制php.ini配置文件,PHP安装程序通常不会复制配置文件,
[root@localhost php-5.3.6]# mkdir /usr/local/php5/etc
[root@localhost php-5.3.6]# cp php.ini-production /usr/local/php5/etc/php.ini
重启apache然后
出现这个页面后,发现date部分出现错误Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/apache/htdocs/index.php on line 2
实际上,从 PHP 5.1.0 ,当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息。而又在php5.1.0中,date.timezone这个选项,默认情况下是关闭的,无论用什么php命令都是格林威治标准时间,但是PHP5.3中好像如果没有设置也会强行抛出了这个错误的,解决此问题,只要本地化一下,就行了。
date_default_timezone_set ('Asia/Shanghai');
[root@localhost src]# tar -zxvf phpMyAdmin-3.4.3.2-all-languages.tar.gz
[root@localhost src]# cp -fr phpMyAdmin-3.4.3.2-all-languages /usr/local/apache2/htdocs/
[root@localhost src]# cd /usr/local/apache2/htdocs/
[root@localhost htdocs]# mv phpMyAdmin-3.4.3.2-all-languages/ ./phpmyadmin
[root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php