首頁 >後端開發 >php教程 >centos7之lamp環境搭建

centos7之lamp環境搭建

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-07-28 08:27:07867瀏覽

一、設定防火牆

CentOS 7.0預設使用的是firewall當防火牆。

1、關firewall:

systemctl stop firewalld.service #停止firewall  
systemctl disable firewalld.service #禁止firewall开机启动  

2、關SELINUX

vi /etc/selinux/config  
#SELINUX=enforcing #注释掉  
SELINUX=disabled #增加  
:wq! #保存退出  
setenforce 0 #使配置立即生效


    yum install httpd #根据提示,输入Y安装即可成功安装  
    systemctl start httpd.service #启动apache  
    systemctl stop httpd.service #停止apache  
    systemctl restart httpd.service #重启apache  
    systemctl enable httpd.service #设置apache开机启动  
    yum install mariadb mariadb-server #询问是否要安装,输入Y即可自动安装,直到安装完成  
    systemctl start mariadb.service #启动MariaDB  
    systemctl stop mariadb.service #停止MariaDB  
    systemctl restart mariadb.service #重启MariaDB  
    systemctl enable mariadb.service #设置开机启动  

3.安裝apache
    修改mysql密码:set password for 'root'@'localhost'=password('root');  

    mysql授权远程连接(navicat等): grant all on *.* to root identified by 'root';  

    yum install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash  
    #这里选择以上安装包进行安装,根据提示输入Y回车  
    systemctl restart mariadb.service #重启MariaDB  
    systemctl restart httpd.service #重启apache  
4.安裝mariadb(mysql)

5、安裝PHP以及組件,使PHP支援MariaDB

測試篇

cd /var/www/html

vi index.php #輸入下方內容

phpinfo();

?>

:wq! #儲存退出

在客戶端瀏覽器輸入伺服器IP位址,可以看到如下圖所示相關的配置資訊!

以上就介紹了 centos7之lamp環境搭建,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn