Centos-LAMP安裝:修訂版本之間的差異
出自幸福奉學網
第 57 行: | 第 57 行: | ||
*1.安裝php及mysql套件:yum install php php-mysql | *1.安裝php及mysql套件:yum install php php-mysql | ||
[https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F359f921b-e307-41dc-9b56-ef4f38f95c17%2FUntitled.png?table=block&id=92e76ddc-f804-4cdf-8022-169c3bd09b97&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1470&userId=&cache=v2 圖示] | [https://therapeutic-principle-c71.notion.site/image/https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fsecure.notion-static.com%2F359f921b-e307-41dc-9b56-ef4f38f95c17%2FUntitled.png?table=block&id=92e76ddc-f804-4cdf-8022-169c3bd09b97&spaceId=e5840612-bae2-49d9-b655-4b0b08db41ec&width=1470&userId=&cache=v2 圖示] | ||
+ | |||
+ | *2.測試php是否能用 | ||
+ | |||
+ | (1)到/var/www/html資料夾之後,新增一個php檔案 linux指定: touch test.php | ||
+ | |||
+ | cd /var/www/html | ||
+ | |||
+ | ---然後---- | ||
+ | |||
+ | cd touch test.php | ||
+ | |||
+ | ---再用vim開啟--- | ||
+ | |||
+ | vim test.php | ||
+ | |||
+ | (2)打入phpinfo(); 測試是否能開起來 | ||
+ | |||
+ | <?php | ||
+ | phpinfo(); | ||
+ | |||
+ | ?> | ||
+ | |||
+ | (3)記得Restart httpd,否則phpinfo不會正常顯示 | ||
+ | |||
+ | systemctl restart httpd | ||
+ | |||
+ | -------之後開始編輯-------- | ||
2022年6月12日 (日) 22:32的修訂版本
目錄 |
1.幸福奉學
1-1 Centos-LAMP安裝
2.幸福分享
一、安裝Apache
- 1.安裝httpd:yum install httpd
- 2.開啟httpd:systemctl start httpd
- 3.確認是否Apache是否運行:systemctl status httpd
- 4.啟動apache to start during system boot:systemctl enable httpd
備註:需要設定防火牆讓http跟https通過,否則如果從本機開啟瀏覽器,會看不到apache網頁
開啟防火牆,讓 web (port:80, 443) 流量可以穿過 firewall
$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload
5.打開Linux瀏覽器,輸入server的IP或數入localhost,看到以下畫面代表成功
二、安裝Mariadb 參考網址
- 1. yum install mariadb-server mariadb
- 2.開啟Mariadb Server:systemctl start mariadb
- 3.確認Mariadb Server是否開啟
4.啟動mariadb to start during system boot(開機時就啟動)
- 5.設定mariadb Secure(設定帳號密碼):mysql_secure_installation
三、安裝PHP+mysql_extension
- 1.安裝php及mysql套件:yum install php php-mysql
- 2.測試php是否能用
(1)到/var/www/html資料夾之後,新增一個php檔案 linux指定: touch test.php
cd /var/www/html
---然後----
cd touch test.php
---再用vim開啟---
vim test.php
(2)打入phpinfo(); 測試是否能開起來
<?php phpinfo();
?>
(3)記得Restart httpd,否則phpinfo不會正常顯示
systemctl restart httpd
之後開始編輯--------
3.幸福茶香
3-1
4.幸福彩虹
4-1