Page 1 of 1

Setting up PHP on my Mac

Posted: Thu Nov 16, 2006 10:34 pm
by woodybepierced
Yes, NEWBIE WARNING!

K, I dont know where I fell off the bus, but I got nothing. I am on a G5 running OSX 10.3.9 and I am trying to learn me some PHP. Well, I know that mac's come with some form of a local sever already on them, but I have to do some setting up for PHP and mySQL... I have read some sites, downloaded some files and still to no aval, got myself no closer to figuring out where I am going wrong and what I need to do to begin understanding the "setup process" for this! So, please, no jokes, if you would please either point me in the correct directions, things I may have missed, a install PHP for dummies pictorial.. you know what im saying!

Thanx,
woody!

Posted: Thu Nov 16, 2006 10:47 pm
by neophyte
I haven't done this on a Mac in a loooooooooooooooooong time. Yup Apache is preinstalled on Macs. You'll need to compile PHP from source and install MySQL. But if you grow tired of that I recall there being a third party installer for PHP/MySQL for macs -- PhpStar ...!?! dunno.

Posted: Fri Nov 17, 2006 12:49 am
by matthijs
http://www.mamp.info/en/index.php. Works perfect. One click install and you have php4, 5, mysql, phpmyadmin, etc.

Posted: Fri Nov 17, 2006 5:13 am
by Chris Corbyn
matthijs wrote:http://www.mamp.info/en/index.php. Works perfect. One click install and you have php4, 5, mysql, phpmyadmin, etc.
I never got Mampp working. It always refused to start apache. Easy(ish) way:

1. Download MySQL-Max binary edition for OS X, Installing this is easy since it's GUI-based
2. Download Apache2 (source code) and extract it
3. Go to apache2 source folder and run command:

Code: Select all

-$    ./configure --prefix=/usr/local/apache2 --enable-mods=ALL
-$    make && make install
4. Test the installation of apache by running "sudo /usr/local/apache2/bin/apachectl start" then view "localhost" in your browser
5. Download PHP source code and extract it
6. Go to PHP source directory and run:

Code: Select all

-$    ./configure --prefix=/usr/local/php5 --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs
-$    make && make install
7. Open /usr/local/apache2/conf/httpd.conf and add the line:

Code: Select all

AddType application/x-httpd-php .php
8. Start MySQL by running /usr/local/mysql/bin/mysqld_safe&
9. Restart apache

Code: Select all

-$    /usr/local/apache2/bin/apachectl stop
-$   /usr/local/apache2/bin/apachectl start
Done.

(Actually i never thought about just how many steps there are there. Basically just compile from source in the order MySQL, Apache, PHP. Place everything in /usr/local/<app> because it's easier to get rid of this way).

Posted: Fri Nov 17, 2006 5:23 am
by JayBird
Also, take a look at http://www.phpmac.com/

Posted: Fri Nov 17, 2006 5:40 am
by matthijs
Well installing on MacBook and MacBook Pro both were without problems. But your explanation doesn't look too difficult. If it's really only these steps it's easy(ish). I have read much much longer tutorials explaining the installation process. Not being familiar with the command line (yet) I always found that a bit intimidating. But maybe that is a gut feeling remaining from my windows experience. Anything that can potentially screw up the system will... :)

(maybe I'll try a manual install with your explanation as well)