搭建 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
#登錄進去

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