RedHat Enterprise Linux 5下配置Apache+Mysql+Php
番茄系统家园 · 2022-04-25 12:27:03
第一步:与软件的准备
版本 redhat enterprise linux 5 ,内核版本 2.6.18
组件选择:GNOME,图形化互联网,编辑器,开发工具,基本,工具,管理工具,X窗口环境
(因为机器有限,要从本机测试,所以GNOME和互联网环境)
第二步:软件包的准备
httpd软件包:httpd-2.2.8.tar.bz2
mysql软件包从mysql官方网站下载,我选用的是ehel5的rpm包
MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
php5软件包:php-5.2.5.tar.bz2
其他库文件:
curl-7.15.0.tar.gz
freetype-2.3.5.tar.gz
gd-2.0.35.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.26.tar.gz
libxml2-2.6.31.tar.gz
PDFlib-7.0.3-Linux-php.tar.gz
t1lib-5.0.0.tar.gz
xpm-3.4k.tar.gz
zlib-1.2.3.tar.gz
gettext-0.16.tar.gz
其他管理软件包:
phpMyAdmin-2.11.6-rc1-all-languages.tar.gz
webmin-1.410.tar.gz
第三步开始:的顺序,httpd和mysql的,从这个环境而言是无所谓的,只是php5软件包要最后,先httpd
简要步骤如下,#号提示符后面为命令,复制所有软件包到一个位置,我这里是在/usr/local/src目录下创建lamp目录,然后复制所有软件包到lamp下
cd /usr/local/src/lamp
tar zxvf httpd-2.2.8.tar.bz2
cd http-2.2.8
./configure --prefix=/usr/local/apache2 --enable-rule=SHARED_CORE --enable-module=so
make
make install
apache完成,输入命令
/usr/local/apache2/bin/apachectl -k start
从本地或其它机器打开Firefox浏览器(我的钟爱),输入地址http://你的器ip地址,记得开放器的80端口,不然可能会提示错误,如果正确的话会出现一个"It works !"的提示页面,此时,apache2基本完成。
接下来进行Mysql的,我先mysql-server的包,提示需要perl-DBI包,从光盘上即可找到,DVD安装的直接就去光盘上的Server文件夹去找就可以了,如果是cd安装,就去cd-2上去同样的目录。
mount /dev/cdrw /media
rpm -ivh /media/Server/perl-DBI-1.52-1.fc6.i386.rpm
完成后再依次mysql的其他包
rpm -Uvh MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
rpm -Uvh MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
rpm -Uvh MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
rpm -Uvh MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
完成后修改mysql的root用户密码,默认为空,修改命令如下
/usr/bin/mysqladmin -u root password '密码字符串'
以后再从命令行登录mysql的就输入
mysql -u root -p
会提示输入密码,Mysql的基本完成。
接下来是其他库文件的,这些软件包的顺序应该可以自由选择(zlib在libpng前),不过我认为可以先把Zlib安装上,仅作参考。
我这次的顺序就没有先zlib,就随便选择来了,先是Curl,
tar zxvf curl-7.15.0.tar.gz
cd curl-7.15.0
./configure --prefix=/usr/local/curl
(我认为可以加上--with-zlib开关,只是这次我没有用)
make
make install
jpeg的,jpeg不能自己创建所需的目录,要提前创建好
mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install
libxml2的
tar zxvf libxml2-2.6.31.tar.gz
cd libxml2
./configure --prefix=/usr/local/libxml2
(可以尝试打开zlib开关,--with-zlib)
make(时间可能稍微长些)
make install
cp xml2-config /usr/bin
LibPDF的
tar zxvf PDFlib-7.0.3-Linux-php.tar.gz
cd pdflib
cp bind/php5/php520mt/libpdf-php.so /usr/local/lib/
(上面的php520mt目录的同级目录中有php503,php510,php520目录,不知道是不是版本的区别)
T1lib的
tar zxvf t1lib-5.0.0.tar.gz
cd t1lib
./configure --prefix=/usr/local/t1lib
make without-doc
make install
Freetype的
tar zxvf freetype-2.3.5.tar.gz
cd freetype
./configure --prefix=/usr/local/freetype
make
make install
Zlib的
tar zxvf zlib-1.2.3.tar.gz
./configure --shared
make
make install
Libpng的
tar zxvf libpng-1.2.26.tar.gz
cd libpng
cp scripts/makefile.linux ./makefile
./configure --prefix=/usr/local/libpng
make
make install
GDlib的,可能会出现 AM_ICON 的错误提示,此时需要 gettext 软件包
tar zxvf gettext-0.16.tar.gz
cd gettext
./configure --prefix=/usr/local/gettext
make
make install(时间稍长)
接下来是gdlib的
tar zxvf gd-2.0.35.tar.gz
cd gd
./configure --with-png=/usr/local/lib \
--with-zlib=/usr/local/lib \
--with-freetype=/usr/local/freetype/lib \
--with-jpeg=/usr/local/jpeg/lib
make
make install
PHP5的
tar zxvf php-5.2.5.tar.bz2
cd php
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs \
--enable-track-vars --with-sockets --enable-sockets --with-sysvshm --with-sysvsem \
--with-pdflib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/jpeg \
--with-png-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl \
--with-libxml-dir=/usr/locallibxml2/lib --with-t1lib=/usr/localt1lib \
--with-gettext=/usr/localgettext/lib --with-gd --with-mysql
(最好加上mbstring 和 mcypt ,不知道是不是必须)
configure后如果成功会提示PHP欢迎界面: Thank you for using PHP.
make
make test
(大约3000多项测试吧)
make install
Php.ini文件的修改
cp php.ini.dist /usr/local/lib/
查找修改extension_dir='./'的内容
extension_dir = /usr/local/lib
extension=libpdf_php.so
保存退出
最后修改apache配置文件httpd.conf
vi /usr/local/apache2/conf/httpd.conf
查找AddType 大约在DefaultType text/plain
输入如下内容
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
(不清楚是不是必须输入这么多项)
查找DirectoryIndex index.html 在其后输入 index.php
保存文件,退出。
测试php,创建info.php文件放到网站的目录下,我这里是/usr/local/apapche2/htdocs
内容如下
相关文章
- 这篇文章主要介绍了Centos7 yum安装git服务器,需要的朋友可以参考下 2021-07-28
CentOS系统怎么安装?今天小编就为大家带来了CentOS Linux系统安装配置图解教程,需要的朋友可以一起看看 2021-06-28
这篇文章主要为大家分享在虚拟机中安装Linux系统CentOS7的方法,非常详细,看了这篇基本上都会了 2020-10-18
Centos8怎么关闭终端响铃?Centos8系统中想要关闭终端响铃选项,该怎么关闭呢?下面我们就来看看Centos系统取消终端响铃的方法,需要的朋友可以参考下 2020-10-09
Centos8系统怎么设置为字符编码?Centos8终端中想要设置我字符编码,该怎么设置呢?下面我们就来看看详细的教程,需要的朋友可以参考下 2020-09-30
Centos8怎么进行复位清屏?Centos8中想要进行复位清屏,该怎么操作呢?下面我们就来看看Centos8终端复位清屏的技巧,需要的朋友可以参考下 2020-09-28
Centos8界面语言怎么设置?Centos8中想要设置语言界面,该怎么设置呢?下面我们就来看看Centos用户界面语言的设置方法,需要的朋友可以参考下 2020-09-28
Linux怎么设置中文语言?Linux系统中中文显示乱码,可能是因为没有安装中文语言包,该怎么安装中文语言包,让linux显示中文呢?我们以centos中文乱码为例,分享解决办法, 2020-05-18
我们有很多项目和软件需要在Linux系统的桌面环境中进行安装和调试,但是有时候我们都在本地使用视窗系统,安装虚拟机也比较麻烦或者不能完全实现运行环境,这里为大家介绍 2020-01-26
这篇文章主要介绍了CentOS 8.0.1905 linux服务器系统安装与配置图解教程,需要的朋友可以参考下 2019-11-19

