搭建 LAMP

1.安装软件

yum install httpd -y #安装httpd
yum install mariadb-server -y #安装mysql这里用mariadb 代替
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
#安装php源
yum -y install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-pear.noarch php70w-process.x86_64 php70w-xml.x86_64 php70w-xmlrpc.x86_64
#安装一大堆php驱动,全部安装上去就对了。

2.配置httpd

vim /etc/httpd/conf.d/virtual.conf #建立一个新的虚拟主机配置文件

<VirtualHost *:80>
    ServerAdmin www.123.com
    DocumentRoot /var/www/html/
    #root 根
    ServerName www.123.com
    #域名
    ErrorLog logs/error_log
    CustomLog logs/access_log common
    #日志
</VirtualHost>
~                                   

~
vim /var/www/html/index.php #新建一个php测试页

<?php
    phpinfo();
?>

systemctl restart httpd #重启httpd
搭建 LAMP
#出现 php 展示页 说明 php可以正常工作

3.配置php程序

https://files.phpmyadmin.net/phpMyAdmin/4.9.4/phpMyAdmin-4.9.4-all-languages.zip
#下载源码,将源码解压到"/var/www/html"目录 如下图
搭建 LAMP

搭建 LAMP
#再次打开 ip 访问,可以看到,phpadmin 页面了

4.登录 phpadmin

systemctl restart mariadb.service #启动"mariadb"
mysql #登录数据库
MariaDB [(none)]> update mysql.user set authentication_string=password('123456') where user='root';#修改密码
或者
update mysql.user set password=password("123456") where user='root';#上面一句不行用这一句
flush privileges ; #刷新权限
搭建 LAMP
账号 root 密码 123456
搭建 LAMP
#登录进去

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章