<a href="http://jingyan.baidu.com/album/3d69c5518e82e3f0cf02d7ea.html?picindex=14" target="_blank">首先為了搭建一個穩定的lamp的練習環境,確定你的虛拟機可以連網,這裡我們使用的yum安裝,它可以幫助我們解決軟體自己的依賴關系.我還在後面加了postgresql資料庫如果不需要的話可以去掉和postgresql的參數.指令如下</a>
<a href="http://jingyan.baidu.com/album/3d69c5518e82e3f0cf02d7ea.html?picindex=14" target="_blank">yum -y install httpd mysql mysql-server php php-mysql postgresql postgresql-server php-postgresql php-pgsql php-devel</a>
<a href="http://jingyan.baidu.com/album/3d69c5518e82e3f0cf02d7ea.html?picindex=14" target="_blank"> </a>
yum安裝過程,大概1-2分鐘
啟動apache服務并檢視時候啟動成功
指令如下:(切記用root使用者啟動服務)
啟動:/etc/rc.d/init.d/httpd start
檢測啟動結果:ps aux | grep httpd
檢視伺服器的ip并進入網站根目錄建立一個phpinfo.php的程式,用于檢視php相關配置資訊。
如果上述進展順利,那我們接下來進行mysql資料庫的配置
指令如下:
啟動: /etc/rc.d/init.d/mysqld start
檢查啟動結果: netstat -tulnp | grep :3306
修改root密碼: mysqladmin -u root password ‘你想設定的密碼’
進入mysql資料庫,建立demo庫和用于測試的person表,并插入測試資料
<a href="http://jingyan.baidu.com/album/3d69c5518e82e3f0cf02d7ea.html?picindex=10" target="_blank"></a>
最後編寫php連接配接mysql的測試代碼,檢測mysql是否能正常配合php工作
本文轉自 陳小龍哈 51CTO部落格,原文連結:http://blog.51cto.com/chenxiaolong/1722676