2 Guys, a Mac, and a Website - The Evolution of the Web - Publishing Your iCal Calendars Locally Pg: 2
October 11th - Hey, happy pantsday.
2 Guys Store

120x60

 Search

 Classic 2 Guys
10 Random Stories:
Another Case of MS Picking on the Little Guy
The Stupidest Story Ever
The Evilness of BuyMusic.com
Super-Inclined Article for Making Laugh
Slow News Weeks Suck like Paris Hilton
2 Guys Podcast for 1/25/05
CNN Article About the Macintosh's 20th B-day
Friday Rumor Roundup
Tiger is about as Similar to SP2 as a Sherman Tank is to a Pineapple
iMac Jr. from Apple?

 Comments
yum hot guys - core
You guys are the pants! - PHP WannaBe
Maybe they don't like you - so they sent you defective product. Have yo... - DJLC
A friend of mine had this product, and the antenna portion quickly came... - Cubist
And the other rule of not commenting on your own article!
...
- Jonahan


 Account
Not logged in.

Username:
Password:
Save password
Not registered?




There are no comments to display.
Add a Comment
(Line and paragraph breaks automatic, HTML allowed, URL trumps e-Mail)

 Publishing Your iCal Calendars Locally Pg: 2
Page 1, Page 2, Page 3

Installing PHP

Now we need to install something called "PHP". PHP is a language used to create dynamic webpages. (2GAMAAW uses PHP) And the page we are going to use to view our Calendars uses PHP, so we need to install it. Luckily this is a lot easier than it used to be. It used to be that you had to download the binary, compile, install, and change apache's configuration file. Not any more, now there is a package installer, and so the installation process has gotten much simpler. First thing we need to do is download it.

1. Go Here and click on "PHP 4.3.4 (entropy.ch Release 1)" to download it.
2. After it's downloaded, double click on "Entropy-PHP-4.3.4-1.dmg" This will mount a image disk on the desktop.
3. If the window doesn't automatically open, double click on the disk.
4. Double click the Package installer "php-4.3.4.pkg"
5. Follow through the installer, and put in your password when it asks for it.

That's all we have to do to install PHP. I told you it's pretty easy.

Installing PHPiCalendar

Now for the program that will display your calendars on the web. What we are going to use is called PHPiCalendar, because it has the best feature set, and is the most compatible with what it is that we are going to use it for. First thing you need to do is download PHPiCalendar.
1. Go to http://phpicalendar.sourceforge.net/nuke/ and click on Downloads in the left hand corner.
2. Click on PHPiCalendar
3. Click on PHPiCalendar 1.0
4. Choose the mirror closest to you. This will download the file "phpicalendar-1.0.tgz" to your desktop.
5. Double click on that file, and it will create a folder on your desktop called "phpicalendar-1.0".
6. Double click on the folder "phpicalendar-1.0"

In here you will see a bunch of files. These are the files that runs PHPiCalendar. What we need to do is decide where we want to put these files, and essentially what we want to have to type in when we want to open the calendar. For instance, if you put these files in a directory called calendar in the sites folder in your home directory, then you would have to type "http://yourip/~yourusername/calendar/" or you could put them in the calendar directory in Apache's root folder, so that you would only have to type in http://yourip/calendar. There are other options as well, and while this may seem confusing, I will go over them in more detail, and give you step by step instructions, so don't worry.

Deciding where to put PHPiCalendar

One of the things I will be going over later is called Dynamic DNS, or dyndns for short. What dyndns does is add a domain nome to your ip. So instead of having to remember your IP (a series of numbers ex: 10.253.1.55) when you want to access your computer, you can just type in a domain, such as macidiot.dyndns.org and it will point to your computer. I will get more in to that later. But with dyndns, you could get a domain, such as "mycalendar.dyndns.org". and then when you type "mycalendar.dyndns.org" in a Web browser, it will bring up your calendar.

If you want to only serve your calendar, and not much else on the web, then you could just install all of PHP's files to the root of Apache's web folder. (/Library/WebServer/Documents/). That way when you type in mycalendar.dyndns.org, it would display your calendar, with no extra tweaking. Or you could put it in a folder, so that when you type in mycalendar.dyndns.org/folder_name it would open it. You can even put the files in your home folders, "Sites" directory, and type in mycalendar.dyndns.org/~yourusername/ to get to it.

But the best way is to use virtual hosts, a feature of Apache that allows you to have more than one domain point to your ip, with different Web pages. The advantage to this is, you can keep your files in any web folder you want, but all you have to type is the domain you are going to use, and it will automatically direct traffic to that directory. Plus if you want to have another website, all you have to do is add another virtual host to Apache's config file.

Before we can add the virtual host, we will need to decide what domain we are going to use, to do that we go on to learning about dyndns.

Creating Dynamic Domain Names

As I explained before, dyndns allows you to make a domain name point to your ip. Since dyndns realizes that this is most beneficial to people with broadband connections (cable, DSL, etc.) and broadband ip's change, they allow quick and automatic updating of your ip for the domain. (That's where the dynamic part comes in) So basically if you have an ip of 1.1.1.1 and you setup mycomputer.dyndns.org to point to 1.1.1.1 and your ip changes to 2.2.2.2, there are several ways to have your domain automatically updated to the new ip. The best part of all of this, is it's free.

The first step is to go to dyndns.org and sign up for a domain name. You will first need to register to get a username and password, once you have done that log in right at the top. Then follow these steps:
1. Click "Account" at the top
2. Next to "Dynamic DNS" click "Add Host"
3. Choose a hostname. In the first box type in what you want to be the first part of your address. Then select what you want the last part to be, from the list.
4. Your real world IP should already be in there, if it isn't put it in. (To get your ip, go to system preferences, and choose network. In the ethernet configuration, under the "TCP/IP tab, you should see your ip)
5. Leave the rest alone and click Add host.

It may take a second for your DNS server to catch up, but to test it, just type in your new address in Safari, and hit "Return". You should see the Apache message that you saw when you tested your Apache installation. (unless you changed those files, then you will see what you changed it to).

Now you will want to set up some way to automatically update your ip if it changes. There are several ways to do this. My router (Siemens) has a feature that will automatically update my dyndns.org account, but if your router doesn't have this feature, there are several software daemons that will do it. (for Free) For a list go to Version Tracker, and search for dyndns.org. Pick any of those, and install according to their instructions.

Creating Virtual Hosts in Apache

As I said before the best way to set up a domain name is to use a virtual host, even if you aren't going to have multiple domains. now that we know our domain, we need to decide were we are going to save our calendar files. Since most of the stuff we keep, we put in our home folders, I'm going to store the PHPiCalendar files in my home site's directory for this example, but you can put them in any directory apache has access to. (Those include the sites folder in your home folder, and /Library/WebServer/Documents/ by default)
1. Open the "phpicalendar-1.0" folder
2. Hold "Command" and hit "a". (This will highlight everything in this folder)
3. Hold "Command" and hit "c". (This will copy all the files/folders in here)
4. Make a new folder (Command-Shift-N) in your "Sites" folder, and name it. I'm going to name it "calendar" for this example.
5. IN that new folder, hold "Command" and hit "v" (This will paste all those files in here).

Now that we have our files in /Users/your_username/Sites/calendar/ we can add a virtual host. To do this we need to open Terminal again. (/Applications/Utilities/)
1. Type in "cd /etc/httpd/"
2. Type in "sudo pico httpd.conf"
3. Hold "Control (ctrl)" and hit the letter "w"
4. Type in "#" and hit Return
5. Using the down arrow, scroll down below the comments.
6. Add a host using this format:


ServerName www.domain.tld
DocumentRoot /www/domain



Change "www.domain.tld" to your dyndns domain, and change "/www/domain/" to the full path to your PHPiCalendar installation. For this example, it would be "/Users/your_username/Sites/calendar/" Now we need to restart apache again.
1. Type in "sudo apachectl graceful restart"
2. Type in Password if it asks for it.

If you got everything correct, you will see the message:
"/usr/sbin/apachectl graceful: httpd gracefully restarted
/usr/sbin/apachectl restart: httpd restarted
"
after you type in your password. If you see this, everything is working fine, if you see an error message, go back over my instructions thus far, and double check everything. If it did work with no errors, and you are not behind a router (if the modem is hooked directly to your compuer) test what we've done so far by typing in your domain in Safari. You should be greeted with a default calendar. If not, double check everything. If you are behind a router, read the next section.

Page 1, Page 2, Page 3

January 8 2004, 10:39 AM EDT, by




Comments:
Name:
URL or e-Mail: (optional)
Comment: (HTML ok)

iMac G5_468x60
MacMini_02

 Site Links
 Deep Thoughts
I bet the main reason the police keep people away from a plane crash is they don't want anybody walking in and lying down in the crash stuff, then, when somebody comes up, act like they just woke up and go, "What was THAT?!"

 Around Da Web
iProng:
iPhone steals show at CTIA Wireless 2007
DLO offers dual cover fashion case for iPod
AT&T received 1M inquiries on iPhone
MacDailyNews:
Ars Technica in-depth review: Apple TV ?impressed all those who touched it?
Inside Apple?s Mac OS X 10.5 Leopard Server OS
The chips inside Apple TV
Think Secret:
Adobe Creative Suite 3 pricing revealed
 Olde Stuff
2 Guys Podcast Feed
Greatest American Hero
iAir
Scary Ballmer
Space Game
 We Like:
 • 2 Guys
 • Apple.com

 Side Projects
Jonahan
  • JediPoker.net
  • Jonahan.com
  • iProng
  • MacProng
iKen
  • MacIdiot
Jedbeck
  • Jedbeck.com
J.P.
  • Baby Ashley Project