mac系統之php開發環境配置

來源:互聯網
上載者:User

標籤:restart   user   目錄   load   chown   hub   cal   brew   服務   

最簡單直接的方式還是使用 Mac 上內建的 Apache 和 PHP。 1.啟動 Apache1>啟動apache $sudo apachectl start;2>啟動後,在瀏覽器中輸入 localhost ,可以看到頁面上顯示 It works。(/Library/WebServer/Documents/ 下的 index.html.en 檔案)3>Apache 的預設根目錄是 /Library/WebServer/Documents/ 2.添加apache對php的支援1>開啟 http.conf 設定檔: sudo vim /etc/apache2/httpd.conf2>找到以下代碼並去掉注釋(去掉前面的‘#’號), wq 儲存退出。 LoadModule php5_module libexec/apache2/ libphp5.so 3.重啟 Apache,進行php類型檔案的調試重啟: sudo apachectl restart在 Apache 的根目錄 /Library/WebServer/Documents/ 下建立project檔案夾並寫一個php檔案輸出‘hello world‘。此時,在瀏覽器開啟 http://localhost/project/test.php 就可以正常看到hello world 了~(如果有許可權問題, sudo chown yourname:staff project 其中yourname是你自己的名字) 4.使用homebrew安裝mysql安裝homebrewruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"安裝mysqlbrew install mysql啟動mysqlmysql.server start   Apache 常用命令 //啟動 Apache 服務 sudo apachectl start// 重新啟動 Apache 服務 sudo apachectl restart // 關閉 Apache 服務 sudo apachectl stop// 查看 Apache 版本 httpd -v

mac系統之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.