PHP on "Personal Web Sharing" ?


Simply Daemonic
I have a PHP page that I would like to try out.
Up to now I haven't been playing with PHP, so I am a complete newbie :cool:
Is there a way to get personal web sharing to do PHP pages? I've seen PHP extensions for Apache 2 on - would this work if I installed it? what version of Apache does Tiger come with?

I am only interested in beta testing pages out on my mac (powerbook 1.25Ghz) so nothing fancy is needed (and I don't much feel like pulling out my wrenches and going under the hood of my mac to setup another webserver ;) )



You already have all that you need to run PHP 4 in your current Apache server, the only thing you need to do is to change the configuration to activate the PHP 4 module.

Open the file "/etc/httpd/httpd.conf" in your text editor of choice, preferrably through sudo in Terminal, as that will let you save the file without extra fuss. Remove the # from the beginning of these two lines:

#LoadModule php4_module libexec/httpd/

#AddModule mod_php4.c

They are in separate parts of the document, and you'll have to scroll down quite a bit before you find the first.

Then add this to the end of the document:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.html index.php

That's it. Now save the document, and stop and start personal web sharing. If you opened without sudo, you won't be able to save it in place directly, so save it on your desktop. Then move the file to the right folder, and when you see a dialogue box telling you that you don't have the permissions, click "Authenticate", and you're set. Restart personal web sharing and everything should work.

If you'd like to play with PHP 5 instead of PHP 4, just go to marc Liyanage's pages, download and run the installer. It'll do the config bit for you.

You'll find the page for PHP 5 here:


Tiger comes with Apache 1.3.33 and PHP 4.3.11

So unless you are going to be running a different version of PHP or Apache in your production environment (or need additional pieces of PHP enabled), I'd stick with what comes with Tiger... it is much easier.