溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

紅旗5.0下apache+php+mysql+phpMyAdmin全攻略(轉(zhuǎn))

發(fā)布時間:2020-08-18 20:12:01 來源:ITPUB博客 閱讀:152 作者:BSDLite 欄目:MySQL數(shù)據(jù)庫
紅旗5.0下apache+php+mysql+phpMyAdmin全攻略(轉(zhuǎn))[@more@]  轉(zhuǎn)貼

這是我在紅旗5.0上的apache+php+mysql+phpMyAdmin安裝過程。運行良好,目前未發(fā)現(xiàn)問題。

需要以下四個壓縮文件:

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

提示啟動失敗了,這是由于權(quán)限的問題,執(zhí)行下列命令:

chown -R root /usr/local/mysql

chgrp -R mysql /usr/local/mysql

執(zhí)行:

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

可以看到類似的內(nèi)容:

[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服務已經(jīng)啟動了。mysql服務器安裝成功了。如還不行,就再檢查mysql文件的權(quán)限。



接著安裝客戶端MySQL-client-4.1.14-0.i386.rpm,這個也直接雙擊安裝。執(zhí)行:

[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

執(zhí)行:

[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",將目錄更改為存放網(wǎng)頁內(nèi)容的目錄。據(jù)我的經(jīng)歷,單單改這個往往還不行,訪問時會出錯。

找到 ,改為 。這時再瀏覽就好了。

如果網(wǎng)站根目錄下有 index.* 的文件,就自動瀏覽此文件,如果沒有,就顯示網(wǎng)站的目錄。在網(wǎng)站沒有做好之前,我習慣讓其顯示目錄,這樣方便調(diào)試。



為測試php是否正常工作,編輯一個phpinfo.php的文件,內(nèi)容如下:


phpinfo();

?>

用瀏覽器打開此文件。若看到php的配置信息,則php正常。



安裝phpMyAdmin-2.5.7,

現(xiàn)在的最新版是2.6.4,但是本人安裝后發(fā)現(xiàn)數(shù)據(jù)庫的中文內(nèi)容為亂碼,一時不知道如何解決,所以選擇了2.5.7,這個版本顯示中文是很好的。

將文件解壓到網(wǎng)頁根目錄下,命名為phpMyAdmin,編輯其目錄下的config.inc.php文件

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

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

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

$cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin/';(否則會出現(xiàn)警告要求你配置)

在瀏覽器中輸入http://localhost/phpMyAdmin就可以連接上了,默認是中文界面的。



至此,apache+php+mysql+phpMyAdmin安裝全部完成。
向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

mi he
AI