標籤:var 添加 org centos7 evel .com 1.7 文本編輯 登陸
CentOS 7.x 安裝apache[[email protected] ~]#yum -y install httpd httpd-devel[[email protected] ~]# systemctl start httpd[[email protected] ~]# systemctl enable httpd CentOS 7.x 安裝 Mariadb 資料庫[[email protected] ~]# yum -y install mariadb mariadb-server mariadb-libs mariadb-devel[[email protected] ~]# systemctl start mariadb [[email protected] ~]# systemctl enable mariadb資料庫安全設定:[[email protected] ~]# mysql_secure_installation登陸資料庫:[[email protected] ~]# mysql -uroot -p Centos7.x 使用yum安裝php71.安裝epel-release 通過命令: yum -y install epel-release 成功安裝。 2.安裝PHP7 終端再次運行如下命令: rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 成功擷取PHP7的yum源,然後再執行: yum -y install php70w Centos7.x 使用yum安裝php7.21、如果之前已經安裝低版本php,先卸載:[[email protected] ~]#yum -y remove php*2、由於linux的yum源不存在php7.x,所以我們要更改yum源rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm3、yum 安裝php72w和各種拓展模組,選自己需要的即可yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml4、最後,寫一個PHP探測指標,測試PHP:[[email protected] ~]#cd /var/www/html/[[email protected] ~]#vi info.php<?php phpinfo();?>儲存並退出5、重啟apache伺服器:[[email protected] ~]# systemctl restart httpd6、訪問 http://localhost/info.php*將php與資料庫關聯:[[email protected] ~]#yum install php-mysql CentOS 7.x 安裝phpmyadmin1、先安裝epel,不然安裝pgpmyadmin時會出現找不到包。[[email protected] ~]# yum install epel-release[[email protected] ~]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm2、[[email protected] ~]# sudo yum install phpmyadmin3、用文字編輯器開啟phpMyAdmin的設定檔(路徑:/etc/httpd/conf.d/phpMyAdmin.conf),找出並注釋掉帶有"Require ip XXXX"字樣的程式碼。會有四處這樣的程式碼,用"Require all granted"取而代之[[email protected] ~]# sudo vi /etc/httpd/conf.d/phpMyAdmin.conf修改後的檔案內容
- <Directory /usr/share/phpMyAdmin/>
- AddDefaultCharset UTF-8
- <IfModule mod_authz_core.c>
- # Apache 2.4
- <RequireAny>
- # Require ip 127.0.0.1 #注釋掉
- # Require ip ::1 #注釋掉
- Require all granted #新添加
- </RequireAny>
- </IfModule>
- <IfModule !mod_authz_core.c>
- # Apache 2.2
- Order Deny,Allow
- Deny from All
- Allow from 127.0.0.1
- Allow from ::1
- </IfModule>
- </Directory>
- <Directory /usr/share/phpMyAdmin/setup/>
- <IfModule mod_authz_core.c>
- # Apache 2.4
- <RequireAny>
- #Require ip 127.0.0.1 #注釋掉
- #Require ip ::1 #注釋掉
- Require all granted #新添加
- </RequireAny>
- </IfModule>
- <IfModule !mod_authz_core.c>
- # Apache 2.2
- Order Deny,Allow
- Deny from All
- Allow from 127.0.0.1
- Allow from ::1
- </IfModule>
- </Directory>
4、[[email protected] ~]# systemctl restart httpd
CentOS 7.x 安裝LAMP