CentOS 7.x 安裝LAMP

來源:互聯網
上載者:User

標籤: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修改後的檔案內容
  1. <Directory /usr/share/phpMyAdmin/>
  2.    AddDefaultCharset UTF-8
  3.    <IfModule mod_authz_core.c>
  4.      # Apache 2.4
  5.      <RequireAny>
  6.       # Require ip 127.0.0.1  #注釋掉
  7.       # Require ip ::1   #注釋掉
  8.       Require all granted   #新添加
  9.      </RequireAny>
  10. </IfModule>
  11. <IfModule !mod_authz_core.c>
  12.      # Apache 2.2
  13.      Order Deny,Allow
  14.      Deny from All
  15.      Allow from 127.0.0.1
  16.      Allow from ::1
  17.    </IfModule>
  18. </Directory>
  19. <Directory /usr/share/phpMyAdmin/setup/>
  20.    <IfModule mod_authz_core.c>
  21.      # Apache 2.4
  22.      <RequireAny>
  23.       #Require ip 127.0.0.1  #注釋掉
  24.       #Require ip ::1   #注釋掉
  25.       Require all granted   #新添加
  26.      </RequireAny>
  27.    </IfModule>
  28.    <IfModule !mod_authz_core.c>
  29.      # Apache 2.2
  30.      Order Deny,Allow
  31.      Deny from All
  32.      Allow from 127.0.0.1
  33.      Allow from ::1
  34.    </IfModule>
  35. </Directory>
4、[[email protected] ~]# systemctl restart  httpd

CentOS 7.x 安裝LAMP

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.