Anyone got PHP to work yet?

That's the only thing keeping me from trying this beauty :)

I just started learning PHP, and I'd like to use the same OS for my server and "casual" needs.

That and drivers for Voodoo 3 cards ;)
i just installed php4 on darwin, and beta should be no different. However, you will need the developer tools in order to compile and install though, and they are not included with beta.
What about My SQL anyone got it working yet? I've got the article bookmarked but haven't had time to install
I was amazed to have installed PHP4 last night via an OS X package... no apache config or anything... it was so easy I almost feel violated... this PHP4 package is available from Tenon ( It is distributed along with their iTools beta.

oooo..... the above post leads me to believe that a compiler (like gcc) is availble for OS X now. I was having this big chicken and egg problem... Sure I can get the source for a compiler -- but how do I compile the dam thing.

...and yes mySQL is available in bianary also. See for a OS X bianary list (updated daily).

Hi Casey.
I tried the tenon install, I can see the files in the apache folder but it does not work.
Must I change something in apache to let it work?

I was able to get things working by doing the following after running the .pkg install. Hope this helps.

1. Add the following lines to /Library/WebServer/Configuration/apache.conf
LoadModule php4_module /System/Library/Apache/Modules/
AddModule mod_php4.c

2. Un-comment the following lines from the same file
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

3. Restart apache.
How do I change the apache.conf file?
I tried msword and saved it as text but then apache won't run anymore.
When I put the old conf file in the folder it works again.

try textEdit, or some other plain text editor. no telling what microsoft adds to their 'text' files...

also, the name of the file must be 'apache.conf' if the extension gets changed by the editor it will not work... such as, "apache.conf.txt" or something like that will not be recognized.
Originally posted by Spencer
How do I change the apache.conf file?
I tried msword and saved it as text but then apache won't run anymore

You are not a linux user ;-)
MSWORD inserts all kinds of stuff in the file which will confuse apache.
You will have to open it with TextEdit, that came with your OSX release, or open it via the Terminal with vi. But vi. is a real hard application to use. I don't think you will succeed in using vi.

BTW keep backing up that file, that was a real smart move. Otherwise we would have had to mail you the file or something. prob.

A good beginner command-line text editor is pico. That's what I started on. It's the same editor that the "pine" e-mail application uses.

I tried texedit before msword but it could not open the file and I read somewere that texedit fileformat is RTF so I did not go further with it because of this.
Also tried simpeltext, which I use for php programming, but could not open it either.
Is a rebuild of Apache needed? I thought the idea of modules was to "Load as needed" kind of thing. Does it work like the Linux kernel, building support for loadable modules when compiling a new kernel?

iMac rev D 333
160 meg ram
20gig HD

Originally posted by FosterBass
I have PHP4 running now under apache on Mac OS X.

First I installed the developer tools from darwin (as per the MacAddict article at ).

Then I downloaded the newest source for apache from into /tmp

Then I downloaded the newest PHP4 installation from into /tmp

The directions at couldn't be more simple.
I think if you do the DSO installation, it does not require a recompile - just restart apache, but otherwise it does.

I could not do the DSO install on mine, did not have a necessary module for it (mod_so.c).
The DSO option is not working yet. I tried it and it just failed, failed, failed. I did all sorts of tweaking of the build scripts and it just would not build for me. I actually did get a built but, alas, it would not load correctly.

I do have it working as a compiled in module. Check out for instructions. If you already have MySQL working, skip the MySQL-specific parts of the process outlined there.

If you want to take your chances, you can also build Apache with shared module (mod_so) support following the directions at my site, then try building the PHP4 DSO. If you get it to work, please let me know how you did it.
I just finished putting together a package that installs apache with the php module into your /usr/local/ directory.
I made a shell script to install it, and I've tested it at work, on a virgin install. No compiler on the test machine, and it works great.

here's the download apache_php.

I'm going to try to build an applescript installer, so it's a double-click install, and then maybe one to install over the existing apache!

Check it out, let me know if it works for you.
Email me, or drop a post here with your results!

Have fun!

Ps- when I compiled, I added support for MySql, so it should be able to connect to an existing mysql server, but I haven't tried it yet. Let me know if anyone else tries it!
I got the php package from tenon and apache from apple to work by adding the few lines with the pico editor from the other post.

Has anybody a package for mysql, the one from tenon is for osx server.
I have to explain. My installer ins't a package! It's just a copy of my installed apache with the php module, and a shell script. I wanted to see if it works. I tested it on my mac at work, and it went fairly smoothly.
It's still asically another hack similar to the Darwin Dev tools hack, very similar, xcept you don't have to download the Darwin img just for the tools, or for those who can't wait for the tools to be realesed.

I'm checking into how to build packages, or maybe an applescript installer. long way to go tho.

Have fun playing with php in X!
The apache distribution that ships with OS X PB has dso support built in. To see for yourself, open a terminal and type the following command.
/usr/sbin/apache -l

If you've compiled your own version and didn't have it use the name "apache" the below should work for you.
/usr/sbin/httpd -l

This reports back all the modules that have been compiled into the apache binary.

For more information on DSO modules, I'd highly reccomend visiting It gives a good high level overview of what they are, why they are useful and even tips on how to create your own.


[Edited by rsanford on 10-11-2000 at 05:40 PM]