Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Enabling the built-in PHP support in 10.2 UNIX
How to enable PHP and configure default index documents to serve index.php. Watch out for quotes. Login in as an Administrator to do this. Enter your password when needed.
  1. Enabling PHP under Mac OS X 10.2. These commands enable php and restart Apache in the Terminal:
     % cd /etc/httpd
    % sudo apxs -e -a -n php4 libexec/httpd/libphp4.so
    % echo 'echo "AddType application/x-httpd-php .php"
    >> /etc/httpd/httpd.conf' | sudo sh -s
    % sudo apachectl graceful
    [editor's note: The line with the backslash is one long line -- if you're hand-typing, remove the backslash and leave a space.]

    PHP should now be running.

  2. Enabling Index.php in the Default Index Documents config. These Terminal commands enable Apache to serve index.php in addition to index.html:
     % pico /etc/httpd/httpd.conf
    Look for "DirectoryIndex index.html" and change it to "DirectoryIndex index.html index.php". Save your changes (use the on-screen prompts) and restart Apache by typing sudo apachectl graceful.

  3. Testing PHP A quick test to see if everything works. Create a generic index.php file that prints the PHP info (either google it or download and unzip this one) and save it in your /Library -> WebServer directory. Now open 127.0.0.1/ in your web browser. You should see a status table with information about the PHP module.
Ta da!

[Editor's note: I have not tested this hint, as my PHP remained enabled through the 10.2 update. Please post if you notice any errors (more than likely due to my editing work!). There are also other hints here on installing PHP and MySQL, but none that specifically address enabling the built-in PHP support in 10.2.]
    •    
  • Currently 2.60 / 5
  You rated: 4 / 5 (5 votes cast)
 
[18,495 views]  

Enabling the built-in PHP support in 10.2 | 4 comments | Create New Account
Click here to return to the 'Enabling the built-in PHP support in 10.2' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easier to build PHP 4.3 yourself
Authored by: flwombat on Jan 24, '03 02:41:01PM
It's possibly easier just to build PHP 4.3 yourself. The PHP shipped with Jaguar is pretty out of date; 4.3 has support for building on OS X.

See this nice O'Reilly tutorial for the instructions.

[ Reply to This | # ]

put AttType and other directives in their proper place
Authored by: imacusr on Jan 24, '03 08:58:26PM

It\'s also probably a bad idea to stick the AddType directive at the end of the httpd.conf file, as it can easily be overlooked by someone expecting to see it in its proper place in the file.

The httpd.conf file is pretty rigidly structured, and people have come to rely on its format over time.



[ Reply to This | # ]
put AttType and other directives in their proper place
Authored by: imacusr on Jan 24, '03 09:00:20PM

sigh... s/Att/Add/ above.

stupid keyboard. :P



[ Reply to This | # ]
Familiar Instructions
Authored by: mac_guy on Jan 27, '03 09:46:42PM

Aren't these the instructions from Liyanage's web site? I recognize them because they place the ADD TYPE at the bottom of the file instead of with the other ADD TYPEs.

http://www.entropy.ch/software/macosx/php/



[ Reply to This | # ]