更新源php
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
1、安裝apachemysql
yum install httpd #根據提示,輸入Y安裝便可成功安裝
/etc/init.d/httpd start #啓動Apache
Apache啓動可能出現的問題:
httpd:httpd: Could not reliably determine the server's fully qualif domain name, using ::1 for ServerName
解決辦法:web
vi /etc/httpd/conf/httpd.conf #編輯 ServerName www.example.com:80 #去掉前面的註釋 :wq! #保存退出
chkconfig httpd on #設爲開機啓動 /etc/init.d/httpd restart #重啓Apache
2、安裝mysqlsql
一、安裝MySQLapache
yum install mysql mysql-server #詢問是否要安裝,輸入Y便可自動安裝,直到安裝完成
/etc/init.d/mysqld start #啓動MySQL chkconfig mysqld on #設爲開機啓動 cp /usr/share/mysql/my-medium.cnf /etc/my.cnf #拷貝配置文件(注意:若是/etc目錄下面默認有一個my.cnf,直接覆蓋便可)
二、爲root帳戶設置密碼dom
mysql_secure_installation
回車,根據提示輸入Yrest
輸入2次密碼,回車code
根據提示一路輸入Yserver
最後出現:Thanks for using MySQL!xml
MySql密碼設置完成,從新啓動 MySQL:
/etc/init.d/mysqld restart #重啓 /etc/init.d/mysqld stop #中止 /etc/init.d/mysqld start #啓動
三 、安裝php
1.查詢是否安裝有php
rpm -qa|grep php
2.刪除以前安裝的php版本
remove php-common #注意查詢的php版本
3.查看php版本列表
yum list php*
5.安裝php及相關軟件
yum install php55w.x86_64 php55w-fpm.x86_64 php55w-mysql.x86_64 php55w-gd.x86_64 libjpeg* php55w-ldap.x86_64 php55w-odbc.x86_64 php55w-pear.noarch php55w-xml.x86_64 php55w-xmlrpc.x86_64 php55w-mbstring.x86_64 php55w-bcmath.x86_64 php-mhash