Mac OS setup apache and php

In : system, Posted by admin on Jun.06, 2009

here is the steps to setup apache and php in your Mac OS X.

  1. Apache and PHP already came with your OS. You just need to enable it.
  2. Go to the apple icon on the menu bar.  Select “System Preferences…” -> “Internet & Network” -> “Sharing”
  3. Enable “Web Sharing” by click on it
  4. You just enabled the web server. You can test it by go to: http://localhost/
  5. To enabled php, in a command window, edit /private/etc/apache2/httpd.conf
  6. remove the “#” character in front of this line: LoadModule php5_module        libexec/apache2/libphp5.so
  7. restart the apache server by: sudo apachectl restart
  8. now you have php enabled.
  9. add a file called: /private/etc/apache2/users/your_username>.conf
  10. put this in the file:
  11. #
    # Allow access to this user’s Sites directory for web clients.
    #
    <Directory “/Users/your_username/Sites/”>
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
  12. remember to replace “your_username” with your username.
  13. restart apache: sudo apachectl restart
  14. put a file in /Users/your_username/Sites/x.htm
  15. go to the browser: http://localhost/~your_username/x.htm
  16. and you will see the file.
Tags :

 
close Reblog this comment
blog comments powered by Disqus