Thursday, May 9, 2013

Running PHP with Apache on Mac


  1. Open the terminal
  2. Type "cd /etc/apache2"
  3. Change permission on httpd.conf by typing "sudo chmod 755 httpd.conf"
  4. Open httpd.conf
    1. Search for "#LoadModule php5_module libexec/apache2/libphp5.so" (line 117)
    2. Uncomment the line by removing "#"
  5. To start the server type "sudo apachectl start"
  6. To stop your server type "sudo apachectl stop"
  7. Your files should be saved in "/Library/WebServer/Documents/ "
  8. On your browser, type "localhost"
    1. You should see "It works!"
Testing your server
  1. Create a file call "test.php"
  2. Copy/Type this in
  3. 
    
  4. Save it in "/Library/WebServer/Documents/ 
  5. Open your browser and type "localhost/test.php"
  6. You should see "Please work"
Ryan has a post explaining what each steps mean.

Source:
  • http://www.editrocket.com/articles/php_mac_os_x.html
  • http://www.cyberciti.biz/faq/restarting-apache-under-oxs-commandline/

0 comments:

Post a Comment