千家信息网

红旗5.0下apache+php+mysql+phpMyAdmin全攻略(转)

发表于:2026-11-03 作者:千家信息网编辑
千家信息网最后更新 2026年11月03日,红旗5.0下apache+php+mysql+phpMyAdmin全攻略(转)[@more@]转贴这是我在红旗5.0上的apache+php+mysql+phpMyAdmin安装过程。运行良好,目前未
千家信息网最后更新 2026年11月03日红旗5.0下apache+php+mysql+phpMyAdmin全攻略(转)红旗5.0下apache+php+mysql+phpMyAdmin全攻略(转)[@more@]  转贴

这是我在红旗5.0上的apache+php+mysql+phpMyAdmin安装过程。运行良好,目前未发现问题。

需要以下四个压缩文件:

mysql-standard-4.1.12-pc-linux-gnu-i686.tar.gz (下载地址http://dev.mysql.com/downloads/mysql/4.1.html)

MySQL-client-4.1.14-0.i386.rpm (mysql客户端) (下载地址http://dev.mysql.com/downloads/mysql/4.1.html)

httpd-2.0.54.tar.gz (下载地址http://httpd.apache.org/download.cgi)

php-4.4.0.tar.gz (下载地址http://www.php.net/downloads.php#v4)

phpMyAdmin-2.5.7-pl1.tar.gz (下载地址http://www.phpmyadmin.net/home_page/downloads.php)

将压缩文件都放在/root,

将mysql-standard-4.1.12-pc-linux-gnu-i686.tar.gz解压,为方便,将文件夹重命名为mysql。移动到/usr/local/(也可以在/usr/local建立个链接到/root/mysql)

[root@shunzi ~]#mv mysql /usr/local/mysql

这是二进制的,不需要编译,只需做一些相应的配置就可以使用了。

[root@shunzi ~]# groupadd mysql

[root@shunzi ~]# useradd -g mysql mysql

[root@shunzi ~]# cd /usr/local/mysql

[root@shunzi mysql]# scripts/mysql_install_db --user=mysql

[root@shunzi mysql]# chown -R root .

[root@shunzi mysql]# chown -R mysql data

[root@shunzi mysql]# chgrp -R mysql .

[root@shunzi mysql]# bin/mysqld_safe --user=mysql &



看到:

[1] 5134

[root@shunzi mysql]# Starting mysqld daemon with databases from /usr/local/mysql/data

STOPPING server from pid file /usr/local/mysql/data/shunzi.pid

030102 21:00:46 mysqld ended

提示启动失败了,这是由于权限的问题,执行下列命令:

chown -R root /usr/local/mysql

chgrp -R mysql /usr/local/mysql

执行:

[root@shunzi mysql]# bin/mysqld_safe --user=root &

可以看到类似的内容:

[1] 5846

5846 pts/1 S 0:00 /bin/sh bin/mysqld_safe --user=root

5864 pts/1 S 0:00
/usr/local/mysql/bin/mysqld
--defaults-extra-file=/usr/local/mysql/data/my.cnf --ba

这说明mysql服务已经启动了。mysql服务器安装成功了。如还不行,就再检查mysql文件的权限。



接着安装客户端MySQL-client-4.1.14-0.i386.rpm,这个也直接双击安装。执行:

[root@shunzi mysql]# mysql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

提示找不到接口文件,借口文件在/tmp/mysql.sock,可建立一个软链接:

[root@shunzi mysql]# mkdir /var/lib/mysql

[root@shunzi mysql]# cd /var/lib/mysql

[root@shunzi mysql]# ln -s /tmp/mysql.sock mysql.sock

执行:

[root@shunzi mysql]# mysql

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 11 to server version: 4.1.12-standard

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>

说明客户端可以与mysql服务器连接上了;为了安全,接着给root 用户设置密码:

mysql> quit

Bye

[root@shunzi mysql]# cd /usr/local/mysql/bin

[root@shunzi bin]# mysqladmin -u root -h localhost password ******(换成你的密码)



***********************************************************************************

安装apache:

[root@shunzi ~]# tar xzvf httpd-2.0.54.tar.gz

[root@shunzi ~]# cd httpd-2.0.54

详细的配置可以用 ./configure --help 来查看,下面只是我的配置。

[root@shunzi httpd-2.0.54]#./configure --prefix=/usr/local/apache
--enable-shared=max --enable-module=rewrite --enable-module=most

[root@shunzi httpd-2.0.54]# make

[root@shunzi httpd-2.0.54]# make install

启动apache服务:

[root@shunzi httpd-2.0.54]# /usr/local/apache/bin/apachectl start

在浏览器里输入http://localhost,如果能看到欢迎页面,那么apache就安装成功了。

***********************************************************************************

安装php:

要先将apache停止:

[root@shunzi ~]# /usr/local/apache/bin/apachectl stop

[root@shunzi httpd-2.0.54]# /usr/local/apache/bin/apachectl stop

[root@shunzi php]# ./configure
--prefix=/usr/local/php --with-mysql=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars
--enable-ftp --enable-inline-optimization
--enable-trans-sid --with-xml --with-gd=/usr/local/gd
--with-png-dir=/usr/local/png --with-zlib-dir=/usr/local/zlibc
--with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype

(事先把png,zlibc,jpeg,freetype安装到/usr/local/下,)



可以看到:

+--------------------------------------------------------------------+

|
License:
|

| This software is subject to the PHP License, available in this |

| distribution in the file LICENSE. By continuing this installation |

| process, you are bound by the terms of this license agreement. |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this
point.
|

+--------------------------------------------------------------------+

|
*** NOTE
***
|

| The
default for register_globals is now
OFF! |

|
|

| If your application relies on register_globals being ON, you |

| should explicitly set it to on in your php.ini
file.
|

| Note that you are strongly encouraged to
read
|

|
http://www.php.net/manual/en/security.globals.php
|

| about the implications of having register_globals set to on, and |

| avoid using it if
possible.
|

+--------------------------------------------------------------------+



Thank you for using PHP.



[root@shunzi php]#make

[root@shunzi php]#make install

拷贝php.ini-dist 到/usr/local/lib,并重命名为php.ini。

[root@shunzi php]# cp php.ini-dist ../lib/php.ini



接下来对httpd.conf文件进行简单的配置,至于详细的配置可参考其他资料。

打开 /usr/local/apache/conf/httpd.conf

找到LoadModule php4_module modules/libphp4.so 一行,在下面添加

AddType application/x-httpd-php .php .phtml

找到DirectoryIndex index.html index.html.var ,在后面添加

index.php index.php3 index.phtml index.htm

使之支持php脚本。

查找DocumentRoot "/usr/local/apache/htdocs",将目录更改为存放网页内容的目录。据我的经历,单单改这个往往还不行,访问时会出错。

找到 ,改为 。这时再浏览就好了。

如果网站根目录下有 index.* 的文件,就自动浏览此文件,如果没有,就显示网站的目录。在网站没有做好之前,我习惯让其显示目录,这样方便调试。



为测试php是否正常工作,编辑一个phpinfo.php的文件,内容如下:


phpinfo();

?>

用浏览器打开此文件。若看到php的配置信息,则php正常。



安装phpMyAdmin-2.5.7,

现在的最新版是2.6.4,但是本人安装后发现数据库的中文内容为乱码,一时不知道如何解决,所以选择了2.5.7,这个版本显示中文是很好的。

将文件解压到网页根目录下,命名为phpMyAdmin,编辑其目录下的config.inc.php文件

$cfg['Servers'][$i]['port'] = '80'; (端口)

$cfg['Servers'][$i]['user'] = 'root';(用户名)

$cfg['Servers'][$i]['password'] = ''; (密码)

$cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin/';(否则会出现警告要求你配置)

在浏览器中输入http://localhost/phpMyAdmin就可以连接上了,默认是中文界面的。



至此,apache+php+mysql+phpMyAdmin安装全部完成。
文件 配置 地址 目录 浏览 内容 服务 客户 客户端 密码 浏览器 网站 这是 中文 红旗 不行 成功 服务器 权限 根目录 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网黑科技 新华互联网科技 互联网科技网 猪兼强互联网科技 互联网 的科技创新 互联网科技上市公司 互联网 科技服务平台 互联网科技大会案例 成都仁贤领冠互联网科技有限公司 山东吉时兔互联网科技有限公司 创业天下互联网科技有限公司 佛山市翊博互联网络科技有限公司 洛阳共同富裕互联网科技有限公司 2021互联网科技公司排名 南通创西澳互联网科技有限公司 张召忠谈中国互联网科技 互联网时代科技型公司的机会 盐城市攀科互联网科技有限公司 科技互联网专业工作会议发言稿 互联网科技快速发展优美句子 互联网佳科技有限公司 互联网科技活动banner 互联网科技公司税收优惠 互联网科技的 亿策互联网科技 贷财互联网科技 崇明区互联网教育科技诚信经营 允成互联网科技有限公司融资 互联网高科技行业有哪些企业 陕西九四连强互联网科技有限公司
0