顯示廣告
隱藏 ✕
看板 Knuckles_note
作者 Knuckles(阿德)
標題 [Linux][CentOS] Apache PHP MySQL 安裝與設定
時間 2010年07月07日 Wed. PM 07:03:09


本文已不再更新,請改至新的文章
[CentOS] Apache 安裝與設定 (CentOS 7) - KnucklesNote板 - Disp BBS
[CentOS] PHP 安裝與設定 (CentOS 7) - KnucklesNote板 - Disp BBS
[CentOS] MariaDB 安裝與設定 (CentOS 7) - KnucklesNote板 - Disp BBS

=============================================
在 CentOS 5 x86_64 安裝 apache, php, MySQL

參考鳥哥的Linux私房菜 http://linux.vbird.org/linux_server/0360apache.php

使用CentOS時,與Ubuntu比較不一樣的地方在於安裝程式的指令為 yum
還有Apache的程式名稱叫做 httpd
其他地方大概都差不多,這篇文章主要記錄一下不一樣的地方

安裝
# yum install httpd mysql-server php php-devel php-mysql

● 修改apache設定檔

# vim /etc/httpd/conf/httpd.conf

#設定保持持續連線
KeepAlive Off #改為 On
MaxKeepAliveRequests 100 #改為500

<IfModule prefork.c>
StartServers       1
MinSpareServers    1
MaxSpareServers    5
ServerLimit       256
MaxClients        256
MaxRequestsPerChild  4000
</IfModule>

# apache程序的使用者與群組
User apache
Group apache

#ServerName www.example.com:80
改為 ServerName disp.cc:80

DocumentRoot "/var/www/html"

DirectoryIndex #要再加上 index.htm 至於 index.php 在 conf.d/php.conf 裡會加

重新啟動 apache
# /etc/init.d/httpd restart

● 將php升級至 5.3

參考 http://gogo2man.world.edoors.com/CeR8uEH5D4xQ

CentOS的php預設只會裝到5.1,若想升到最新的5.3,必需抓remi的rpm檔來升級
(新版的phpMyAdmin必需使用PHP5.2以上)
以下為 x86_64 的版本,若是 i386 可參考上面的網址

http://rpm.pbone.net/index.php3?stat=3&search=epel-release&srodzaj=3&dist[]=52 (這裡) 找epel載點

# wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
# rpm -Uvh epel-release-5-3.noarch.rpm remi-release-5.rpm

執行以下執令即可自動升級 php 與 MySQL
# yum --enablerepo=remi update

若要使用phpMyAdmin要再安裝 php-mbstring
# yum --enablerepo=remi install php-mbstring

● 修改 /etc/php.ini

short_open_tag = On ;改成Off

display_errors = Off
log_errors = On
ignore_repeated_errors = On
ignore_repeated_source = On

date.timezone =  Asia/Taipei

; cookie存活時間設為一個禮拜
session.cookie_lifetime = 604800

; session存活時間設為一個禮拜
session.gc_maxlifetime = 604800

● 設定 MySQL

初次啟動
/etc/init.d/mysqld start

修改root密碼
mysqladmin -u root password 密碼

設定 MySQL 服務隨系統一起啟動
# chkconfig mysqld on

確認 MySQL 自動啟動有打開
# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
如果2--5為on的狀態就OK


--
※ 來源: DISP BBS 看板: Knuckles_note 文章連結: http://disp.cc/b/11-3Gx
※ 作者: Knuckles  來自: 118.166.115.124  時間: 2010-07-07 19:03:09
※ 編輯: Knuckles  來自: 118.166.118.246  時間: 2010-07-27 01:15:57
※ 編輯: Knuckles 時間: 2017-02-14 14:56:48
※ 看板: KnucklesNote 文章推薦值: 0 目前人氣: 0 累積人氣: 6727 
※ 文章分類: Apache 網頁伺服器設定
分享網址: 複製 已複製
terrykyo 轉錄至看板 terrykyo 時間:2011-04-04 01:58:44
r)回覆 e)編輯 d)刪除 M)收藏 ^x)轉錄 同主題: =)首篇 [)上篇 ])下篇
看板名稱: 確定(Enter) 取消(Esc) 搜尋(Space)
查詢帳號: 確定(Enter) 取消(Esc) 搜尋(Space)
搜尋: m)m文 b)進板 c)未分類 a)作者 /)標題 q)取消?[q]

搜尋 送出(Enter) 取消(Esc)

回覆文章至: f)看板 m)作者信箱 b)兩者皆是 q)取消?[f]
要引用原文嗎? y)引用原文 n)不引用 a)全部回覆 r)複製原文 q)取消?[y]
轉錄本文章於看板: 1)使用連結 2)使用複製 q)取消 ?[1]
轉寄至站內信箱於使用者: 確定(Enter) 取消(Esc)
轉寄至站內信箱於使用者: 確定(Enter) 取消(Esc)
修改文章標題為: 確定(Enter) 取消(Esc)
修改文章標題為: 確定(Enter) 取消(Esc) 全部(a)

確定要刪除這篇文章?(可按大U救回) 確定(Enter) 取消(Esc)

刪除理由:

確定(Enter) 取消(Esc)
加到這個分類: 確定(Enter) 下一層(→) 回上層(←) 取消(Esc)
你覺得這篇文章: 1)真讚 2)真瞎 q)取消?[1] (再選一次即可收回)
你覺得這篇文章: 1)值得推薦 2)表示反對 3)單純註解 q)取消?[3]
guest
預覽(Enter) 取消(Esc)
上傳圖片
按ctrl+Enter可輸入下一行。
guest
確定要送出? 確定(Enter) 取消(Esc) 繼續(e)
搜尋: 送出(Enter) 取消(Esc)

▏▎▍▌▋▊▉ 請按任意鍵繼續