Getting Started with PHP on Mac OS X: A Quick Guide for Beginners
This article provides a brief and incomplete overview for setting up PHP on Mac OS X, specifically aimed at the University of Texas’ PHP User Group. It outlines three methods for obtaining PHP: compiling from source, downloading a binary distribution, or using the built-in version from Mac OS X Server. The guide emphasizes the importance of using built-in tools like Apache and encourages documentation of configuration settings. Additional resources and links are provided for further exploration, including PEAR and phpMyAdmin, which enhance PHP development on Mac.
Getting Started with PHP on Mac OS X: A Quick Guide for Beginners
E N D
Presentation Transcript
Using PHP onMac OS X • A brief and entirely incomplete HOW-TO for • the University of Texas’ PHP User’s Group
Just read this article: • http://developer.apple.com/internet/macosx/php.html • http://www.phpmac.com/ • The end.
Just kidding... • There are three ways to get PHP: • built it yourself (see previous article) • download a binary distribution • use what’s provided (Mac OS X Server)
Built It Yourself... • Download Mac OS X Developer Tools from http://developer.apple.com/tools/ (requires free registration) • Read http://www.macdevcenter.com/pub/a/mac/collections/unix.html • Read http://developer.apple.com/internet/macosx/php.html
Before you BIY... • Consider the following: • Using built-in Apache? Probably a good idea • Which options will you support? A few suggestions: • apache, inline-optimization, zlib, libjpeg, libpng, gd, mysql or pgsql, xml, apxs, dom • Are those installed? Where are the libs? If you use Fink, they’re mostly in /sw. Many others in /usr/local
Document what config options you use! A good rule: use what is provided, print that out and save it • Use the “recommended” php.ini (http://cvs.php.net/co.php/php4/php.ini-recommended)
Binary distributions • http://www.entropy.ch/software/ • http://www.aaronfaby.com/
About binary dists... • Caveat emptor • Uncertain update schedule (possible delay for vulnerability updates) • Configuration may have missed something, or more likely took kitchen sink approach • Some platforms, may be linked to non-free libraries you can’t have (should use gnu!)
Use what you’re given • Jaguar has Apache 1.3 with PHP 4.3 • Read http://www.macdevcenter.com/pub/a/mac/2002/01/04/apache_macosx_pt3.html
Great! But... • Apple doesn’t update components frequently - usually security fixes only, unless it’s with an OS revision • You don’t get to chose config options • Doesn’t use recommended php.ini • Can you find any build documentation?
OS X vs. OS X Server • No huge difference - it’s Apache 1.3.x either way • Mac OS X Server has cute GUI tools for configuring - use them, even if you’re a CLUI buff, otherwise you risk breaking updates • None of the 3rd-party installers clobber built-in configs, so be prepared to explicitly name directories, etc. (this is a good thing)
PEAR • What is it? Kind of like CPAN • Support built into Jaguar • Read http://www.macdevcenter.com/pub/a/mac/2003/01/21/pear_macosx.html • http://pear.php.net/
Useful Links • http://www.phpmac.com/ • http://developer.apple.com/internet/macosx/ • http://www.macdevcenter.com/ • http://fink.sourceforge.net/ • http://osdir.com/
Fink • http://fink.sourceforge.net/ • Based on Debian dpkg/apt-get suite • Mac OSS community well represented • Fink Commander provides GUI wrapper: http://finkcommander.sourceforge.net/
phpMyAdmin • http://www.phpmyadmin.net/ • Built in PHP (but not 5, nor mySQL 4.1 yet) • Download it to any PHP-enabled web server, edit config.inc.php and you’re done • Use .htaccess, and consider running under SSL cuz you’ll likely run it as SQL “root” user • Consider only starting it when you need it
Apple Project Builder • http://developer.apple.com/internet/macosx/phpappledevtools.html • “Pretty” editor, with colors and code bracketing/formatting • Built-in CVS utilities - e.g. PEAR checkout • 2.1 “broke” pretty colors within PHP code, as near as I can tell :(
Last words/Q & A • Got any?