安装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
安装mysqltar zxvf mysql-3.23.58.tar.gzcd mysql-3.23.58./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysqlmakemake 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-zlibmake&&makeinstall这样报错: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.confYou may want to add: /usr/local/php/lib/php to your php.ini include_pathInstalling 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.confLoadModule php5_module modules/libphp5.so(2)、添加默认的文件格式# vi /usr/local/apache2/conf/httpd.conf找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容AddType application/x-httpd-php .phpAddType application/x-httpd-php-source .phps(3)、添加默认的首页DirectoryIndex index.html index.htm index.php编写index.php# vi /usr/local/apache2/htdocs/index.php<?phpphpinfo ();?>rm /usr/local/apache2/htdocs/index.html同时移除原来的index.html重启http服务/usr/local/apache2/bin/apachectl restart
2. 安装 Apache2.1 拷贝 Apache 源码包(比如:httpd-2.2.3.tar.gz)到 /usr/local/src 目录下并安装#cd/usr/local/src#tar-zxvf httpd-2.2.3.tar.gz#cdhttpd-2.2.3// 安装路径、提供DSO支持、支持地址重写功能#./configure --prefix=/usr/local/httpd --enable-module=so --enable-module=rewrite#make&makeinstall#/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