Mac內建Apache和Php

來源:互聯網
上載者:User

標籤:http   ar   使用   sp   檔案   on   art   bs   ad   



Mac 是預設安裝 apache和php,但是需要使用root使用者來啟用,所以請按照我下面的步驟來:

一、啟用root使用者
1、選取系統喜好設定...。
2、從顯示菜單中,選取“帳戶”。
3、點按鎖表徵圖並使用系統管理員帳戶進入。
4、點擊“登入選項”。
5、點按右下方的“加入”按鈕。
6、點擊“開啟目錄工具 + 生產力”按鈕。
7、點按“目錄工具 + 生產力”視窗中的鎖表徵圖。
8、輸入系統管理員帳戶名稱和密碼,然後點按“好”。
9、從編輯菜單中選取啟用 root 使用者。  
10、在“密碼”和“驗證”欄位中輸入您想要使用的 root 密碼,然後點按“好”

二、啟用apache
1、進入終端    應用程式--工具 + 生產力--終端
2、輸入su斷行符號
3、輸入root密碼斷行符號
4、啟動apache,輸入命令  apachectl start
5、apache的主目錄是:/libary/webserver/documents/
6、開啟瀏覽器輸入:http://127.0.0.1/ 可以看到輸出:it works!

三、讓apache支援php
1、命令列輸入:vi /etc/apache2/httpd.conf
2、修改#loadmodule php5_module        libexec/apache2/libphp5.so
     把#刪掉


3、命令列輸入:cp /etc/php.ini.default /etc/php.ini
4、重啟apache
      apachectl restart
5、在/libary/webserver/documents/目錄中建立一個新檔案index.php來測試php是否支援
輸入:

<?php
    phpinfo();
?>
6、在瀏覽器中輸入:http://127.0.0.1/index.php 如果正確的話,可以輸出php資訊

 

Mac內建Apache和Php

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.