我在centos6.5 32位上操作
下载
[root@localhost]# cd /usr/local/src
[root@localhost src]# wget http://mirrors.sohu.com/apache/httpd-2.2.31.tar.gz
[root@localhost src]# wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73-linux-i686-glibc23.tar.gz
[root@localhost src]# wget http://cn2.php.net/distributions/php-5.6.28.tar.gz
apache安装
解压
[root@localhost src]# tar -zxvf httpd-2.2.31.tar.gz
[root@localhost src]# cd httpd-2.2.31
配置编译参数
[root@localhost httpd-2.2.31]# ./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --with-pcre
报错
error: mod_deflate has been requested but can not be built due to prerequisite failures
解决办法:
#yum install -y zlib-devel
编译
[root@localhost httpd-2.2.31]# make
注:报错都是缺少库文件,用yum list搜索对应的包,还有一个yum whatprovides
安装
[root@localhost httpd-2.2.31]# make install
启动:
#/usr/local/apache2/bin/apachectl start
启动报错:
httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName
解决方法:
#vim /usr/local/apache2/conf/httpd.conf
ServerName www.example.com:80
改为 ServerName localhost:80
重启无报错
#/usr/local/apache2/bin/apachectl restart
mysql安装
解压
# tar -zxvf /usr/local/src/mysql-5.1.73-linux-i686-glibc23 .tar.gz
挪动位置
# mv mysql-5.1.73-linux-i686-glibc23 .tar.gz /usr/local/mysql
创建mysql用户
# useradd -s /sbin/nologin mysql
# cd /usr/local/mysql
创建datadir,数据库文件存放位置
# mkdir -p /data/mysql
# chown -R mysql:mysql /data/mysql
# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql/
注:如果看到2个OK,表示执行正确。
配置mysql
拷贝配置文件
[root@ly-linux mysql]# cp support-files/my-large.cnf /etc/my.cnf
cp:是否覆盖"/etc/my.cnf"? y
拷贝启动脚本,并修改其属性
[root@ly-linux mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@ly-linux mysql]# chmod 755 /etc/init.d/mysqld
修改启动脚本
[root@ly-linux mysql]# vi /etc/init.d/mysqld
注:需要修改的地方
basedir=/usr/local/mysql
datadir=/data/mysql
把启动脚本加入系统服务项,设定开机启动
[root@ly-linux mysql]# chkconfig --add mysqld
[root@ly-linux mysql]# chkconfig mysqld on
[root@ly-linux mysql]# service mysqld start
Starting MySQL.. SUCCESS!
注:如果启动不了,查看错误日志。
php安装
解压,进入php目录
[root@localhost php-5.3.27]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif --disable-ipv6
报错:
configure: error: xml2-config not found. Please check your libxml2 installation.
解决办法:
yum install -y libxml2-devel
报错;
configure: error: Cannot find OpenSSL‘s <evp.h>
解决办法:
yum install -y openssl openssl-devel
报错:
checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution
解决办法:
yum install -y bzip2 bzip2-devel
报错:
configure: error: png.h not found.
解决办法:
yum install -y libpng libpng-devel
报错:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
编译make:
[root@ly-linux php-5.6.28]# make
报错:
make: 警告:检测到时钟错误。您的创建可能是不完整的。
原因:编译过程中时间比系统时间更靠后
解决:修改时间
安装:
[root@ly-linux php-5.6.28]# make install
以上安装过程完成,但是php安装完成后,并不能直接使用,需要进行一些配置
本文出自 “Liew” 博客,请务必保留此出处http://walterliew.blog.51cto.com/11286797/1882834
原文地址:http://walterliew.blog.51cto.com/11286797/1882834