mac下安裝apache+php+mysql

來源:互聯網
上載者:User

標籤:

運行“sudo apachectl start”,再輸入帳號密碼,這樣Apache就運行了。

運行“sudo apachectl -v”,你會看到Mac OS X 10.6.3中的Apache版本號碼:

Server version: Apache/2.2.14 (Unix)

Server built:   Feb 11 2010 14:40:31

這樣在瀏覽器中輸入“http://localhost”,就可以看到出現一個內容為“It works!”的頁面,它位於“/Library(資產庫)/WebServer/Documents/”下,這是Apache的預設根目錄。

在終端中運行“sudo vi /etc/apache2/httpd.conf”,開啟Apache的設定檔。

找到“#LoadModule php5_module libexec/apache2/libphp5.so”,把前面的#號去掉,儲存(在命令列輸入:w)並退出vi(在命令列輸入:q)。

運行“sudo cp /etc/php.ini.default /etc/php.ini”,這樣就可以通過php.ini來配置各種PHP功能了。

運行“sudo apachectl restart”,重啟Apache,這樣PHP就可以用了。

運行“cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php”,即在Apache的根目錄下複製index.html.en檔案並重新命名為info.php

在終端中運行“vi /Library/WebServer/Document/info.php”,這樣就可以在vi中編輯info.php檔案了。在“It’s works!”後面加上“<?php phpinfo(); ?>”,然後儲存之。這樣就可以在http://localhost/info.php中看到有關PHP的資訊,比如版本號碼是5.3.1。

mac下安裝apache+php+mysql

聯繫我們

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