Apr 27 2009
By: Jon Gales
Alright. By now you’ve got PHP running and know how to do CGI scripts. If
you’ve forgotten, check last
week’s column. There is some good and bad news this week. The good news
is that this is a pretty darn long/good/amazing article. The bad news is that
it’s the end of the series. if you’ve enjoyed or even just followed this series
I’d like to hear from you. PowerUser Monday
isn’t going away–just the web serving series. Also, if you’ve gotten a website
set up from this I’d like to get your link so I
to the bottom of this page (hopefully
get you some traffic as well).
Now we’re going to install MySQL. It’s the most popular open source database
in the world and it just rocks. It’s often used with PHP and web applications
- It’s free
- It kicks serious butt
- It runs on Windows, *nix and OS X
Instead of downloading source code and having the joys of learning how to
compile it, we’re going to cheat and use a package made by the MySQL people.
This is new to version 4.0 (just came out) and it rocks. Visit this
download the file. Be nice and give them your info–they aren’t spammers. They
have given a good chunk of their lives for this software… Give them honest
answers. It’s a 7.1 meg download which isn’t bad for what you get.
You’ll find the downloaded file in your default downloads folder called, “
Just double click on it like any other DMG. Inside you’ll find a package (yep,
that’s what that those box icon thingies are)–double click it. The installer
is self explanatory.
Since it’s unix software you won’t see a GUI application. To start it up you
must delve into the terminal. If you feel inclined (you should) install a
script by Marc
Liyanage that boots MySQL at startup. To start it without having to restart
your computer just pop open the terminal and type the following:
shell> cd /usr/local/mysql
shell> sudo ./bin/mysqld_safe
(Enter your password)
(Press CTRL+D to exit the shell)
If you have problems, refer to MySQL’s
OS X installation guide. It sums it
all up well.
Now, you need to set your password. Enter the terminal again and type:
mysqladmin -u root password YOURNEWPASSWORD
Try to make this secure, you won’t need to type it in much and it’s important.
Now, we want to do something with our newfound database. You can download
a great Cocoa app called YourSQL that will log in for you and let you muck
around a little easier than in the Terminal. It’s free and I use it all the
time. However, the remainder of this app will focus on setting up a CMS that
uses MySQL, not MySQL (that’s another week folks).
Weblogs are hot right now and a lot of people either have or want to have
one. If you’re one in the second category wish no longer. Go to pMachine.com and
download a copy (it’s free). I use it and love it. There are lots of other
great free Content Management Systems like MovableType, PHP Nuke, and B2 but
pMachine is just plain easy (and the programmer is a big Mac guy).
/Library/WebServer/Documents/ and drag all of the files
folder to it. Once that’s done point your browser to http://localhost/pm/install.php
and follow the on screen directions. Below are some pointers.
It will probably say you have to mess with
config.php. Just open it up (it’s
in the pm directory) in a text editor and make the following changes:
$hostname = "localhost";
$dbusername = "root";
$dbpassword = "YOURNEWPASSWORD";
Obviously YOURNEWPASSWORD is what you entered prior in the MySQL installation.
If all goes well you should see some green when you refresh step two. The rest
of the installer is self explanatory. When you get to the part where it asks
for the domain make sure you don’t leave it as localhost if you’ve registered
a domain. if you need help on this, check part
You’ve now got a dynamic database powered weblog hosted off your computer!
You can administer things via http://localhost/pm/.
If you don’t like the template, feel free to change it. All it takes is a
text editor (yes, Dreamweaver or GoLive will work) and mess with the files
/Library/WebServer/Documents/. For instance, weblog.php is the main
page. It’s pretty easy hacking. My weblog is powered by pMachine if you want an example of what can be done (don’t use mine as a high bar, it sucks ).
User submitted sites: