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

Installing PHP4.04 on OS X v10.0 Apps
A generous Mac user, 'olav', has made a pre-packaged double-click PHP 4.04 installer available! Thanks to 'jacco' for the pointer to the address.

NOTE: The following instructions apply to the files found in the "Archive" folder on olav's iDisk -- see the comments for a discussion of problems related to the new package that's also there at the root level. I installed from the 'Archive' files, and had no problems at all.

You can find the PHP files on olav's iDisk, right here.

This is about as easy as it gets for installing PHP 4; read the rest of this article if you'd like the (simple) step by step instructions.

NOTE: These steps assume some familiarity with the terminal window and UNIX in general, which is a Good Thing to have if you're going to be using PHP (and mySQL).

On Olav's iDisk, in the Archives folder, you'll see three files:

httpd.conf - the Apache configuration file
phpinfo.php - a test php script, to prove it's working
php-4.04pl1.tgz - the pre-packaged PHP 4.04

Here's how I installed it and got it working.
  1. Download all three files to a convenient location.

  2. Stop the webserver if it's running (via the GUI or "apachectl stop")

  3. Make a backup copy of your httpd.conf file, and then move the new httpd.conf into /etc/httpd. If you've extensively modified your httpd.conf, you'll probably just want to to a 'diff' on the two files to see what's been changed, and hand edit your original.

  4. Move phpinfo.php to your preferred webserver documents location. Apache comes pre-configured to serve documents out of either /Library/WebServer/Documents, or /Users/username/sites, so take your pick. If you use the "sites" folder, the URL is http://[your address]/~username; otherwise, it's just http://[your address].

  5. Unpack the installer. When I downloaded it (with OW 4.0fc3), Stuffit tried to expand the archive. It sort of worked, but I didn't wind up with a usable file. So I took the '.tar' file that resulted, and simply typed "tar -xvzf php-4.0.4pl1.tgz", which created an installer package on the desktop.

  6. Double-click the installer, enter your password, and watch it install.

  7. Restart the Apache webserver (again, GUI or 'apachectl start').

  8. Test your PHP install by loading the test file: http://[your address]/phpinfo.php (or the alternate version if you're using the sites folder). You should get a cool page of system info.
That's it! Thanks, Olav, for getting this done so quickly!
  • Currently 2.14 / 5
  You rated: 1 / 5 (7 votes cast)

Installing PHP4.04 on OS X v10.0 | 24 comments | Create New Account
Click here to return to the 'Installing PHP4.04 on OS X v10.0' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
it works! now we need MySQL
Authored by: kirsch on Mar 27, '01 07:04:24PM

All we need now is a package that installs MySQL just as easily and we're set. Thank you olav

[ Reply to This | # ]
it works! now we need MySQL
Authored by: skribble on Mar 29, '01 07:59:12AM

I've got a binary MacOSX package for MySQL available on my iDisk (user: skribble) it installs everything into /usr/local/mysql/

run /usr/local/mysql/bin/mysql_install_db
then /usr/local/mysql/bin/safe_mysqld to fire it up

(I've created a few soft links from /usr/local/bin/ to things like mysql, mysqladmin, ...)


[ Reply to This | # ]
New package available
Authored by: Anonymous on Mar 28, '01 06:27:33PM

Thanks Rob, for being so quick in writing up installation notes!

I've moved all of the original material into an "archive" folder, and created a new disk image that shouldn't suffer from unstuffing problems. (OS X's native /Application/Utilities/Stuffit Expander seems to do okay, at least when the original tarball is dragged onto it.)

This build fixes the PEAR support, and includes the complete source.

[ Reply to This | # ]
New package available
Authored by: Anonymous on Mar 28, '01 09:22:26PM

All I get is a parse error when I try and view any php page after installing this. Do you have any ideas? -Thnx!

[ Reply to This | # ]
Re:problem installing new package
Authored by: Anonymous on Mar 29, '01 12:20:39AM

That's the typical symptom of the broken PHP. Sounds like you didn't get the new package installed? Did you remember to restart apache?

Also, there are some differences from Rob's notes above.

There's no need to unpack the tarball that comes on the disk image. (As noted in the ReadMe on the disk image, this tarball is the source to PHP, unlike the tarball described in Rob's notes.)

Just double-click on the package, enter your password, and then follow the remaining directions above. (Replace the httpd.conf file, and restart apache.)

[ Reply to This | # ]
Re:problem installing new package
Authored by: rev on Mar 29, '01 12:55:24AM

Getting the same error after following your instructions three times over. I get a parse error upon trying to run some simple PHP. Oddly enough, phps seems to work fine.

[ Reply to This | # ]
Re:problem installing new package
Authored by: Anonymous on Mar 29, '01 10:31:02AM

Yep...I've installed it properly as well multiple times and still no success.

[ Reply to This | # ]
Re:problem installing new package
Authored by: Anonymous on Mar 29, '01 02:16:41PM

The new package was installing to the wrong directory. There's a new "new package" posted. Apologies to all -- and thanks for your patience....

[ Reply to This | # ]
Re:problem installing new package
Authored by: Anonymous on Apr 01, '01 11:17:53AM

i downloaded the new package [without having installed the original one], and i keep getting PHP parse errors. the php code is fine - no syntax errors at all. But no matter what script i write, there's always a parse error on the first line of code.

any ideas?


[ Reply to This | # ]
Authored by: Anonymous on Mar 29, '01 06:12:55AM

I keep getting parse error???

any help

[ Reply to This | # ]
Authored by: Anonymous on Mar 29, '01 02:12:11PM

Yes, thanks for pointing this out. Basically the package on the original diskimage was installing to the root and not into usr (You'll find /libexec and /local directories that it created).

The package has been fixed.

[ Reply to This | # ]
Authored by: cj69collins on Apr 15, '01 09:11:39PM

I re-downloaded the package. It still 'installs' the files to root [/], not to /usr. It is just a matter of relocation, so it is no problem.:

mv -r /local/lib /usr/local
mv /local/bin/* /usr/local/bin
mv /libexec/httpd/* /usr/libexec/httpd.

No more parse errors, but now I need to get my info displayed.

[ Reply to This | # ]
Authored by: hcarvallo on Apr 18, '01 04:07:17AM

I've had the same relocation problems even with the newest package so I did the relocation you mention but got some errrors with the mv command on the terminal.

Before all I stopped Apache : apachectl stop

First I did : mv -r /local/lib /usr/local
and got an error with the -r
So I did : mv -f /local/lib /usr/local
It worked fine

I also got an error with :
mv /local/bin/* /usr/local/bin

So I just did :
mv -f /local/bin /usr/local

Finally I moved from /libexec/httpd to /usr/libexec/httpd and removed (rmdir) the local and libexec directories from root.

Restarted Apache : apachectl restart

After that no more parse errors with infophp.php

[ Reply to This | # ]
Try the 'archive'
Authored by: robg on Mar 29, '01 10:38:37AM

Until olav can say something about the errors, you could try downloading the files from the "Archive" folder on his iDisk. Those are the ones I used and wrote the instructions for. I'm not getting any parse errors, and I did exactly what's listed above -- just with the "Archive" files, not the new disk image.


[ Reply to This | # ]
Authored by: Anonymous on Mar 29, '01 12:12:18PM


open the terminal and type in the following

sudo /bin/tcsh

cd /

apachectl stop

rm usr/libexec/httpd/

cp libexec/httpd/ /usr/libexec/http

apachectl restart

All done try it, it work for me any comments


[ Reply to This | # ]
Authored by: Anonymous on Mar 29, '01 01:39:02PM

cp libexec/httpd/ /usr/libexec/http

this should be cp libexec/httpd/ /usr/libexec/httpd

I miss the 'd'


[ Reply to This | # ]
Authored by: Anonymous on Apr 02, '01 05:20:26AM

This worked! Thanx

[ Reply to This | # ]
apache and php and mysql
Authored by: Anonymous on Mar 29, '01 03:24:15PM
On various places on the Internet there have been hints as to how to get apache and php working, or how to get mysql working. Using these hints, I could get Apache and PHP working, and MySQL, however NOT together :-(
Today I figured out how to do it: compile MySQL with a static zlib, not the dynamic zlib included by Apple. My recipe for how to do it can be found at Enjoy!

[ Reply to This | # ]
apache and php and mysql
Authored by: Anonymous on Mar 29, '01 03:28:24PM
apache and php and mysql
Authored by: Anonymous on Apr 01, '01 10:48:58PM

I've just tried to configure and compile mySQL 3.23.36 on OSX and have run into some compile errors with (apparently) MIT pthreads. I've followed tuxzone's directions, changing the sql/ file and compiling zlib. Configure works, but I get these errors when compiling:

/bin/sh ../mkinstalldirs /usr/local/mysql/include/mysql
/usr/bin/install -c -m 644 readline.h /usr/local/mysql/include/mysql/readline.h
/usr/bin/install -c -m 644 chardefs.h /usr/local/mysql/include/mysql/chardefs.h
/usr/bin/install -c -m 644 keymaps.h /usr/local/mysql/include/mysql/keymaps.h
/usr/bin/install -c -m 644 history.h /usr/local/mysql/include/mysql/history.h
/usr/bin/install -c -m 644 tilde.h /usr/local/mysql/include/mysql/tilde.h
Making install in mit-pthreads
cd: no such file or directory: /home/my/tmp/BUILD/mit-pthreads
GNUmakefile:55: /pthreads/ No such file or directory
GNUmakefile:56: /stdlib/ No such file or directory
GNUmakefile:57: /stdio/ No such file or directory
GNUmakefile:58: /string/ No such file or directory
GNUmakefile:59: /gen/ No such file or directory
GNUmakefile:60: /net/ No such file or directory
GNUmakefile:61: /scripts/ No such file or directory
make[1]: *** No rule to make target `/scripts/'. Stop.
make: *** [install-recursive] Error 1

Any idea where my little train is leaving the tracks?

[ Reply to This | # ]
apache and php and mysql
Authored by: Anonymous on Apr 02, '01 05:24:40AM

I had this problem with mit-threads, and solved it by deleting the source directory completely, downloading a fresh copy, and starting all over again. Don't forget to fix the bug:

edit msql/ to fix a compile error
sa.sa_handler=( void (*)() ) handle_segfault;
sa.sa_handler=( void (*)(int) ) handle_segfault;

[ Reply to This | # ]
apache and php and mysql
Authored by: aalegado on Apr 02, '01 01:32:53AM

For my Linux boxen I've used a tutorial found at:

This tutorial integrates MySQL, PHP, Apache, and OpenSSL. I was able to modify the procedure to include mod_perl support as well. However, the tutorial as written doesn't work under Darwin/Mac OS X. Among other things, the PHP portion ends with errors after the 'make install' and OpenSSL won't compile under Darwin.

The MySQL part can DEFINITELY shed some light on that part of the process. I nipped out the OpenSSL stuff and tried to do a basic MySQL/PHP/Apache install but the PHP errors persist. I've only spent one afternoon at it so a solution may still be available.

The important thing about achieving it this way is that 1) it's built from sources, and 2) it integrates all three applications. I'd like to build it this way so that my OS X installation matches my production Linux installation feature-for-feature and directory-for-directory.

The "canned" MySQL and PHP maybe be do-able but do they work together?

I was able to compile MySQL and it works but I've yet to test it against the Olav PHP package. I'll try installing PHPNuke and see what happens. PHPNuke is a combination portal/discussion board that uses PHP and MySQL to build an interactive site not unlike SlashDot or GeekLog. If that works then no further research is required.

[ Reply to This | # ]
Authored by: robg on Apr 02, '01 01:42:37AM

I have Olav's PHP package (from the archive) running on Apache with mySQL that I compiled from source (see how-to elsewhere on the site). They're working great together; I made a start page that lets me pick from phpBB, geeklog, phpNuke, phpMyAdmin, and phpWebSite (all packages that I'm experimenting with, and that use PHP and mySQL).

They all work exactly as expected!


[ Reply to This | # ]
PHP4.0.4 + XSLT (Sablotron)
Authored by: Anonymous on Apr 02, '01 10:59:56AM
I dove into Mac OS X, eager to get the XSL-Transform engine Sablotron running with PHP.

PHP will configure --withapxs and make, but as soon as I configure --withapxs --with-sablot=/usr/local/lib --with-expat=/usr/local/lib, make fails.

I know Sablotron and expat are functioning properly (the shell command sabcmd functions quite nicely). I think PHP is is having trouble because it also comes with an older version of expat.

Has anyone else tried this? With what resolve?

XSLT is so powerful, any tips to get it running are very appreciated!


[ Reply to This | # ]