How to activate PHP in Mac OS

Leopard:

  • Startup Terminal, and run the following commands:
    1. $> cd /etc/apache2/
      $> sudo pico httpd.conf
      [Enter]
      press [CTRL]+[W]
      type: php [Enter]
  • You should see the following line:
    1. # LoadModule php5_module libexec/apache2/libphp5.so
      Now remove the hash (#)
    Thats it, now save the file:
    press [CTRL]+[O], [Enter]

    To exit Pico, press [Ctrl]+[X]

    To activate PHP, reboot or enter in terminal:
    $> sudo apachectl restart

    Tiger:

  • Startup Terminal, and run the following commands:
    1. $> cd /etc/httpd
      $> sudo pico httpd.conf
      [Enter]
      press [CTRL]+[W]
      type: php [Enter]
  • You should see the following line:
    1. # LoadModule php4_module libexec/httpd/libphp4.so
      Now remove the hash (#)
      Repeat the same procedure until you find this line:
      # AddModule mod_php4.c
      And remove the hash (#).
    Thats it, now save the file:
    press [CTRL]+[O], [Enter]

    To exit Pico, press [Ctrl]+[X]

    To activate PHP, reboot or enter in terminal:
    $> sudo apachectl restart

    Comments (4)  Permalink

    Comments

    sffc @ 29.05.2007 23:29 CEST
    There's another easy way to access httpd.conf. In Safari, go to this address:

    file:///private/etc/httpd/httpd.conf

    Open the file in Text Edit, and follow the above procedure, and save the file as you normally would.
    Cristiano Betta @ 08.01.2008 19:07 CEST
    Thanx for setting up a quick cheatsheet.
    Paulo Resende @ 21.01.2008 13:26 CEST
    My system is the leopard but i don´t have the httpd.conf in my system!!
    Lyoness @ 18.03.2008 20:01 CEST
    That worked great! Thanks for this!

    add a comment

    This blog is gravatar enabled.
    Your email adress will never be published.
    Comment spam will be deleted!

    Name*
    E-Mail
    For Spammers Only
    URL
    Comment*
    Notify me via E-Mail when new comments are made to this entry
    Remember me (needs cookies)