Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,000 hints and counting!

10.4: Install Apache2, PHP5, and MySQL5 Apps
Tiger only hintHere's how I installed Apache2 (version 2.0.55) and MySQL5 (Standard 5.0.16 for Mac OS X 10.4) on OS X 10.4...

[robg adds: Note that I haven't tested this one, and I added some detail to the hint as submitted -- so any mistakes are likely mine. Read on for the step-by-step...]

  1. Install Apache 2 into /Library/Apache2)

  2. Install MySQL5 [download link]. This will automatically install in /usr/local.

  3. Install PHP5 [download link from entropy.ch]. This version automatically installs in /usr/local)

  4. Create a folder named opt at the root of your hard drive. You can make it invisible with something like File Buddy.

  5. In Terminal, create a symbolic link: ln -s /Library/Apache2/ /opt/apache2

  6. Open the Apache2 Configuration file, which can be found in /Library -> Apache2 -> conf -> httpd.conf. Add the following lines (before Load module):
    # PHP5 configuration for Entropy PHP
    LoadModule php5_module /usr/local/php5/libphp5.so 
    AddType application/x-httpd-php .php 
    AddType application/x-httpd-php-source .phps
  7. Reboot, then start the Apache web server.
This was tested on 10.4.3 with Developper tools 2.2.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[56,774 views]  

10.4: Install Apache2, PHP5, and MySQL5 | 18 comments | Create New Account
Click here to return to the '10.4: Install Apache2, PHP5, and MySQL5' hint
The following comments are owned by whomever posted them. This site is not responsible for what they say.
10.4: Install Apache2, PHP5, and MySQL5
Authored by: laurencewilks on Tue, Dec 20 2005 at 8:11AM PST
This might cause problems if you're running the pre-installed version of Apache (1.3.x).

Two ggod links are:

Building and Installing Apache 2 and PHP 5.0.5 on Mac OS X 10.4 Tiger

or

Building and Installing Apache 2 and PHP 5.1.1 on Mac OS X 10.4.3 Tiger



[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: krasi on Wed, Dec 21 2005 at 7:32AM PST
that apache install guide works for apache but trying to intall php fails beause the apxs is not found properly. In the apache config you have to add a line but i couldn't understand since this is the first time i tried it also and it failed on me. the apache2 directory was created and so was the bin/apxs file but no go.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: trollll on Tue, Dec 20 2005 at 10:07AM PST
Might want to give people more info for an article named "Install Apache2, PHP5, and MySQL5" than:

1. Install Apache 2
2. Install MySQL5
3. Install PHP5
4. Make a folder (you might want to say why you want people to do this)
5. Add the config lines (most helpful piece of info you've posted)
6. Reboot and start the server

Seriously... The comment linking to phpmac had more useful info for people who haven't done this before. People who have done this before would understand how to do those steps, but they wouldn't need them in the first place.

Having config examples like:

~/Desktop/apache-2.0.54 $ ./configure --prefix=/usr/local/apache2
~/Desktop/apache-2.0.54 $ make
~/Desktop/apache-2.0.54 $ sudo make install

and

~/Desktop/php-5.1.0 $ ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-xml --enable-simplexml --with-config-file-path=/usr/local/php/lib
~/Desktop/php-5.1.0 $ make
~/Desktop/php-5.1.0 $ sudo make install

Would help people a little more.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: tforrest on Tue, Dec 20 2005 at 10:55AM PST
Indeed, why would you want to make the symbolic link to /opt?

I am by no means a terminal guru but I have installed several things from source. I agree, this hint is of little use. Why bother with these ultra simplified steps? Who does this serve?

The phpmac links provided above at least give you some background...

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: descoff on Tue, Dec 20 2005 at 1:02PM PST
Personally I'd like to thank the poster for taking the time, giving the proper links etc... Thanks! And if other posters can improve all the better: that's the spirit.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: macgruder on Wed, Dec 21 2005 at 12:45AM PST
I have to agree with the problems for with this hint. It's all very well being grateful for the links, but a hint that involves doing something serious in 'guts' of your system had better be clear and correct.

As far as I know, the php install from entropy.ch doesn't work with Apache2. Also, this hint doesn't seem to actually say how to start Apache or even to install it. Certainly making Apache start up on boot if you have Apache 1.3 and Apache 2 both installed is not trivial, yet this hint doesn't mention it.

Marc (entropy.ch) did heroic work in the early days of OS X in getting PHP working on the Mac, but nowadays a source install is probably a better idea. You get the latest version of PHP and you can get the settings you need.

The opt alias seems to have no purpose. I've been running Apache, PHP and MySQL on my machine since 10.0 and I've never heard of a opt requirement for anything on OS X - yet alone for Apache.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: miname on Thu, Dec 22 2005 at 3:29AM PST

The title of this hint is kind of misleading.

I believe this hint is for the users who want to use Entropy's PHP 5 package with their Complete Apache 2 installation in OS X client.

As you might know, current Entropy's PHP 5.0.4 package was complied for the OS X Server, not the client version. so the 'opt' folder comes in here to imitate the OS X Server directory structure. (the original Apache web server that comes with OS X Server is located in /opt/apache2)

There are lots of options we can install A2P5M5 nowadays, but again, it is a good idea to check other resources available on the Web (including the link laurencewilks mentioned above) and understand exactly what you are doing before making any modifications to your precious system.



[ Reply to This | # ]
non-hint of the week
Authored by: sjk on Thu, Dec 22 2005 at 8:57PM PST
I also question the value of this hint and who it's really intended to serve. I think it's an unnecessary oversimplification and trivialization of what even some experienced admins consider a fairly complicated installation/configuration process. And linking directly to specific versions of this software is a poor practice since it's updated fairly frequently, sometimes with important security fixes. Pick your favorite "handing a loaded gun to a child" analogy to describe how I generally feel about this hint.

What miname wrote about about checking other resources and understanding what you're doing is good advice when setting up a web server, especially if it's going to be on the internet. Same's generally true with other network services, too.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: gregraven on Wed, Dec 21 2005 at 9:29AM PST
How is this better than using MAMP?

http://www.mamp.info/en/home/

---
--
Greg Raven
Apple Valley, CA

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: gregor on Fri, Jan 13 2006 at 5:46AM PST
For example, MAMP currently only comes with PHP 5.0.4. If you need 5.1, you have to install it manually.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: RogParish on Wed, Mar 29 2006 at 3:31AM PST
MAMP does NOT incorporate MySQL 5; it still uses MySQL 4.1.12. See:
http://www.mamp.info/en/help/releases/#1.1.1

---
Roger
Lovettsville, VA

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: MADmacFr on Wed, Feb 22 2006 at 7:59AM PST
MAMP is only for Web development (as EasyPHP on Wintel)
It is not for a production server (MAMP is not secure).

---
To the one who is hungry, rather than to give him some fish, learn him how to fish.

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: mccabem on Tue, Mar 28 2006 at 2:15PM PST
It's trivially simple (and well documented) how to secure this xAMP installation:

Link [mamp.info]

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: Tétonne on Sat, Apr 15 2006 at 11:19AM PDT
mysql 5 new release :
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-standard-5.0.19-osx10.4-powerpc-64bit.dmg/from/http://mysql.crihan.fr/

[ Reply to This | # ]
10.4: Install Apache2, PHP5, and MySQL5
Authored by: sjk on Sun, Apr 16 2006 at 2:12AM PDT
5.0.20 was announced a couple days ago but so far binary distributions are only available for 10.3 (PPC) and 10.4 (x86).

[ Reply to This | # ]
10.4: Building and Installing Apache 2.2.2 and PHP 5.1.4 on Mac OS X 10.4.6
Authored by: Tétonne on Sun, May 14 2006 at 4:22AM PDT
Building and Installing Apache 2.2.2 and PHP 5.1.4 on Mac OS X 10.4.6

http://www.phpmac.com/articles.php?view=252

[ Reply to This | # ]
10.4: Install Apache 2.2.3, PHP 5.1.15, and MySQL 5.0.24
Authored by: Tétonne on Fri, Aug 25 2006 at 12:02PM PDT

this will only work if you have XCode installed - get it for free at Apple's Developer website

In Terminal...

Download

wget http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-max-5.0.24-osx10.4-powerpc.tar.gz/from/http://mirrors.dotsrc.org/mysql/
wget http://www.apache.org/dist/httpd/httpd-2.2.3.tar.gz
wget http://www.php.net/distributions/php-5.1.5.tar.gz

<!-- you can replace wget by curl -O >

Decompress
gnutar -xzf mysql-max-5.0.24-osx10.4-powerpc.tar.gz
gnutar -xzf httpd-2.2.3.tar.gz
gnutar -xzf php-5.1.5.tar.gz

Backup mysql data and install mysql
cp -Rp /usr/local/mysql/data /Users/your_user_name/
rm -rf /usr/local/mysql
mv mysql-max-5.0.24-osx10.4-powerpc /usr/local/mysql
rm -rf /usr/local/mysql/data
mv data /usr/local/mysql/data

Compile Apache
cd httpd-2.2.3
./configure --prefix=/Library/Apache2 --enable-access --enable-actions --enable-alias --enable-asis --enable-auth --enable-auth_dbm --enable-auth_digest --enable-autoindex --enable-cache --enable-cgi --enable-dav --enable-dav_fs --enable-deflate --enable-dir --enable-disk_cache --enable-dumpio --enable-env --enable-expires --enable-fastcgi --enable-file_cache --enable-headers --enable-imap --enable-include --enable-info --enable-log_config --enable-log_forensic --enable-logio --enable-mem_cache --enable-mime --enable-mime_magic --enable-negotiation --enable-perl --enable-rewrite --enable-setenvif --enable-speling --enable-ssl --enable-status --enable-suexec --enable-unique_id --enable-userdir --enable-usertrack --enable-version --enable-vhost_alias --enable-so --enable-module=all --enable-shared=max
make
make install

Compile php
cd php-5.1.5
mkdir /usr/local/php
./configure --prefix=/usr/local/php --with-zlib --with-xml --with-xsl --with-mysql=/usr/local/mysql --with-apxs2=/Library/Apache2/bin/apxs
make
make install
cp php.ini-dist /usr/local/php/lib/php.ini

Add in httpd.conf (Library/Apache2/conf)
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

sudo /Library/Apache2/bin/apachectl start

Thanks to bofh

[ Reply to This | # ]

10.4: Install Apache 2.2.3, PHP 5.1.15, and MySQL 5.0.24
Authored by: comforteagle on Wed, Aug 30 2006 at 8:30AM PDT
Followed this a few times, even reinstalled dev tools just in case, but get this error:

/Library/Apache2/bin/apachectl: line 102: 22898 Segmentation fault $HTTPD -k $ARGV


Help!?
Thanks in advance.

[ Reply to This | # ]