Use Mac as a Web Server (3/5)
Posted by Wesley on
Let's run something useful that uses the APM setup. Since I have phpBB and s9y running on this website, I'll look at those. Sounds pretty obvious, considering the reasons why I'm writing this.
4. phpBB
phpBB is a popular internet message board system usually found in many websites and communities around the globe. In Korea, Zeroboard is often used more, however. Both systems use PHP and MySQL to operate. Actually, phpBB is more flexible in that it can use other database engines such as MS-SQL and Access. In the past I would have installed Zeroboard, but I decided to go against the local norm now. I'll do a bit of comparison between the two in a later article if I'm willing.
4. phpBB
phpBB is a popular internet message board system usually found in many websites and communities around the globe. In Korea, Zeroboard is often used more, however. Both systems use PHP and MySQL to operate. Actually, phpBB is more flexible in that it can use other database engines such as MS-SQL and Access. In the past I would have installed Zeroboard, but I decided to go against the local norm now. I'll do a bit of comparison between the two in a later article if I'm willing.
Go to the Downloads section of phpBB website and download the phpBB 2.0.16 [ Full Package ] (version number may change). Compression types won't matter since the integrated BOMArchive Helper in OS X should decompress all of them. Once downloaded, decompress the package and you'll have a folder containing the essence of phpBB. Rename the folder if you want, and move it to the root of your website folder (remember? /Library/WebServer/Documents/ ).
Before configuring, we first need to create a database that phpBB will use. I didn't read the manual carefully and wondered why the configuration page was giving me errors. Bleh. You don't need to make this mistake. To set up a database, get the trusty Terminal app out once again. Type:
/usr/local/mysql/bin/mysql -u root -p
Once in the MySQL prompt, we need to create a database and a user account that will use the database. We could just use the root account, but that might not be so secure... To create a database:
CREATE DATABASE dbname
This is explained in section 3.3.1 of the MySQL manual. dbname should be the name of the database you want to use for phpBB. At this point, if you're going to just use the root account the job is done. However, let's delve further and create an account that will only be able to access this database. Type:
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
ON dbname.* TO 'dbuser'@'localhost' IDENTIFIED BY 'userpw';
This is explained in section 5.7.2 of the MySQL manual. The whole thing can be typed out in one line. MySQL will accept the entries until it encounters a semicolon. Here, dbname is the database we created above, the dbuser is the name of the account we're creating that'll have privileges to the database, and the userpw is the password that dbuser will use. Note that the user will only be accessible from 'localhost'. Oh, yeah, don't forget the single quotes.
Alright, if that's set up without errors, let's get out of MySQL monitor by typing 'exit' and move onto configuring phpBB. Hope you didn't close Terminal, because we need to do one more thing. Type
cd /Library/WebServer/Documents/phpBB2
sudo chown username:www config.php
chmod 660 config.php
username is your username on the Mac. If you don't know, open Finder and it's displayed right next to the house-shaped icon. PhpBB2 is the name of the folder that contains phpBB files. We need to change the file permissions for config.php so it can be rewritten by the configuration page. Don't close Terminal yet.
Open up your web browser and connect to phpBB folder. http://address/phpBB2/ should be good enough, where address is your web site's address (System Preferences - Sharing - Services - Personal Web Sharing and see bottom) and phpBB2 is, again, the folder where the phpBB files are present.
You'll see 'Welcome to phpBB 2 Installation' page now. Database Type should be MySQL 4.x since that's what we installed earlier. Leave Database Server Hostname as localhost. I think it's pretty obvious what to enter in Your Database Name, Database Username, and Database Password. Prefix should be left as it is. On the Admin Configuration section, empty boxes should be appropriately filled, and the auto-filled boxes should be left as they are. One thing to note, though, is the Domain Name box. By default it'll say 127.0.0.1 and this is fine as long as you'll be configuring phpBB from localhost.. that is, your own computer. However, to configure from elsewhere as well, you might need an actual domain name. Let's leave this for now.
Press Start Install at the bottom and everything should go without problems. It will then tell you to delete some folders (contrib and install). Don't forget to do this. It's for security reasons. Also, for the same reaons, go back to the Terminal window and type:
chmod 640 config.php
This is done so it won't be modified unwillingly. We now have phpBB installed. connecting to the default page (http://address/phpBB2/) should now get you to your own phpBB discussion board main page. Login with your admin account and you can configure the board further via the 'Go to Administration Panel' link at the bottom of the page.
Next, we'll look at installing s9y.