centos 下手动安装mysql,php,apache,zend,zlib

安装ncurses
# yum install ncurses-devel -y
# tar -zxvf ncurses-5.9.tar.gz
# ./configure
# make
# make install

安装 zlib包:

找到相应的下载地址:

http://sourceforge.net/projects/libpng/files/zlib/1.2.7/

$tar -xvzf zlib-1.2.3.tar.gz
$cd zlib-1.2.3.tar.gz
$./configure
$make

$make install 

安装mysql
tar zxvf mysql-3.23.58.tar.gz  
cd mysql-3.23.58 

#./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql 

./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-extra-charsets=gbk,gb2312,utf8

make 

make install 

#prefix=/usr/local/mysql mysql安装的目标目录 

#sysconfdir=/etc my.ini配置文件的路径 

#localstatedir=/var/lib/mysql 数据库存放的路径 

安装php

yum install libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel libtool-ltdl-devel
tar -jxvf php-5.3.6.tar.bz2
cd php-5.3.6
#./configure --prefix=/usr/local/php -with-apxs2=/usr/local/httpd/bin/apxs --with-curl --with-mcry#pt --enable-mbstring

./configure --prefix=/usr/local/php -with-apxs2=/usr/local/httpd/bin/apxs  --with-mysql=/usr/local/mysql  --with-zlib
make && make install
这样报错:
configure: error: mcrypt.h not found. Please reinstall libmcrypt. 
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz
#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make & make install

然后再安装PHP

有时候会出现这样的错误

Wrote PEAR system config file at: /usr/local/php/etc/pear.conf
You may want to add: /usr/local/php/lib/php to your php.ini include_path
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/

解决方案:

rm -rf /usr/local/php/lib/php/.channels
/usr/local/php/bin/pecl update-channels

然后再安装PHP

 配置httpd.conf使支持 php

1.httpd.conf配置
(1)、以上全都正确后,会自动加入对php模块支持
# vi /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so 
(2)、添加默认的文件格式
# vi /usr/local/apache2/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
(3)、添加默认的首页
DirectoryIndex index.html index.htm index.php
编写index.php
# vi /usr/local/apache2/htdocs/index.php
<?php
phpinfo();
?>
rm /usr/local/apache2/htdocs/index.html
同时移除原来的index.html
重启http服务
/usr/local/apache2/bin/apachectl restart

2. 安装 Apache
  2.1 拷贝 Apache 源码包(比如:httpd-2.2.3.tar.gz)到 /usr/local/src 目录下并安装
    #cd /usr/local/src
    #tar -zxvf httpd-2.2.3.tar.gz
    #cd httpd-2.2.3

    // 安装路径、提供DSO支持、支持地址重写功能
    #./configure --prefix=/usr/local/httpd --enable-module=so --enable-module=rewrite 
    #make && #make install

    #/usr/local/httpd/bin/apachectl start  // 启动 apache
    #/usr/local/httpd/bin/apachectl stop  // 停止 apache
    #/usr/local/httpd/bin/apachectl restart  // 重启 apache

复制php.ini-dist为php.ini,并存放到/usr/local/php目录下!
[root@localhost php-5.2.6]# cp php.ini-dist /usr/local/php/php.ini
编辑/usr/local/php/php.ini文件,找到如下的一行
;default_charset = "iso-8859-1"
在这行下面加一行
default_charset = "gb2312
//下边组合apache+php

相关推荐