CentOS Linux 下配置Apache2+PHP5+MySQL5+GD库的方法
2024-08-27 18:28:20
供稿:网友
先安装MYSQL 服务器
解压MySQL,把所有文件复制到/usr/local/mysql
[root@Bleach usr]# groupadd mysql
[root@Bleach usr]# useradd -g mysql mysql
[root@Bleach mysql]# cd /usr/local/mysql
[root@Bleach mysql]# scrīpts/mysql_install_db --user=mysql
[root@Bleach mysql]# chown -R root .
[root@Bleach mysql]# chown -R mysql data
[root@Bleach mysql]# chgrp -R mysql .
[root@Bleach mysql]# ./bin/mysqld_safe --user=mysql &
[root@Bleach mysql]# ./bin/mysqladmin -u root password mysql
[root@Bleach mysql]# cp ./support-files/mysql.server /etc/init.d/mysql
[root@Bleach mysql]# cd /etc/rc3.d/
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql S85mysql
[root@Bleach rc3.d]# ln -s /etc/init.d/mysql K85mysql
安装GD库基本包
#rpm -ivh gd-devel-1.8.4-11.i386.rpm
安装XPM支持
#rpm -ivh xpm-3.4k-2.i386.rpm
安装libxml2 (记得PHP5.1.1只支持libxml2-2.6.11以上版本)
#tar zxvf libxml2-2.6.11.tar.gz
#cd libxml2-2.6.11
#./configure
#make
#make install
开始装GD库支持
-------------------------------------------------------
先安装GD基础rpm包
#rpm –ivh gd-devel.rpm
ZLIB
#./configure
#make
#make install
JPEGSRC
#./configure --enable-shared
#make
#make install-lib
#make install
LIBPNG
#cp scrīpts/makefile.std Makefile
#make
#make install
最后是GD2.*
#./configure --with-png=/usr/local --with-jpeg=/usr/local --with-freetype=/usr
#make
#make install
----------------------------------------------
上面一切都很顺利的话,GD就算成功的安装上了. 如果有问题,应该是缺少支持包,总之是少什么就下载什
么来安装上.
跟着下来,开始安装APAHCHE2和PHP5
#./configure --prefix=/usr/local/apache2 --enable-module=so
#make
#make install
PHP5
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-
dir=/usr/local --with-png-dir=/usr/local --with-gd=/usr/local --enable-trace-vars --with-
zlib-dir=/usr/local -with-mysql=/usr/local/mysql --enable-mbstring=all
#make
#make install
复制PHP.INI文件到正确位置
在PHP目录下运行
#cp php.ini-dist /usr/local/php/lib/php.ini
编辑apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
要改的有如下几处:
一般都在
#AddType application/x-tar .tgz
下加一行
AddType application/x-httpd-php .php