Editable shared iCal server

—by Joel Rennich, mactroll@afp548.com

31 January 2003 — Updated 4 February 2003

Wow say that five times fast. While this is still a technology in formation, so be prepared for potential problems, you can get a shared calendar that iCal can subscribe to and all users can add items to from a Web interface. This is not a full calendaring solution yet, since you won’t be able to make changes from iCal itself—just view the calendar—but it’s still pretty useful to have in your bag of tricks.

The actual calendar is kept in a MySQL database that dynamically creates the iCal data files when queried by clients. This is a pretty slick way of retrofitting the flat data files into a database. However, anything involving a database gets a bit more complicated.

First off you will need PHP enabled on your server. This is done with a text editor as root and uncommenting two lines in /etc/httpd/httpd.conf. Apple include the requisite directions in the file.

After you have done that you’ll need to get a MySQL database up and running. You will need a separate database for this setup, plus a user with read/write abilities to that database. Please see our article on using phpMyAdmin to do this or follow our tutorial on how to start this up from the command line.

Next you want to install phpiCalendar. We also have an article on this and the installation is quite simple.

With all of these PHP packages that we will be using, it’s important that you actually read the directions here. I have confused myself a few times when going through this since they all have similar names. Take heart, dear reader, and plow through the confusion and into the promised land of editable calendars.

Finally, you can get into setting up phpMyCal. First off go and download the package from http://dev.neb.net/phpMyCal/. StuffIt Expander should kick in and decompress the code.

We now need to combine a few folders to get everything together. Benjamin Levy, the author of phpMyCal, has put a lot of support in the code to allow you to use it without phpiCalendar, but we want a Web interface and since there is none better than phpiCalendar we’ll go with it.

In the phpMyCal folder, create another folder called “phpMyCal". In this new folder, combine the contents of the “bridge” and the “core” folders that you got with the phpMyCal source code. Now you want to edit the config.phpMyCal.php file that is in the new folder. You can do this in TextEdit if you want. Keep it simple.

You need to tell phpMyCal a few things about your MySQL server. If your MySQL database lives on another machine change, “localhost” to the IP address of that machine; otherwise, don’t touch! Now swap “username” with the user you created to administer the phpMyCal MySQL database that you just created. Change “password” to reflect the password you gave to that user. Finally, change “database” to the name of the MySQL database that you created to hold the calendars.

It would also be advisable to change “adminpw” to something a little more secure. This is the admin password for adding and deleting your new editable calendars, so you shouldn’t be stupid with this.

Save your changes and the move the phpMyCal folder that you created into the folder where you installed phpiCalendar.

The last thing you need to move is the files inside the “phpicalendar_edits” folder inside the phpMyCal distribution folder need to be integrated into the phpiCalendar folder. So just go ahead and use the Finder to do this, but be careful to just copy the individual files and not the whole folders so you don’t overwrite all of the files, just the ones you need to change.

You should be good to go now. So, make sure that your web server is up and running. Now you can intialize phpMyCal by going to this url:

http://yourserver/path/to/phpMyCal/init.phpMyCal.php?cal_initialize=yes

You’ll want to change the front part so that it matches the actual location of phpMyCal. Now go to your phpiCalendar site. Things should look pretty much the same as a normal phpiCalendar setup, but if you look in the lower right hand corner you’ll see a link to phpMyCal with a version number. Click on this and you’ll be taken to the phpMyCal admin page. Here you can create and delete phpMyCal calendars. Rember the phpMyCal password you set up since you’ll need to enter this in the bottom field when you create a new calendar. You’ll also be asked for a calendar password. This will force users to have this password before making changes to the calendar. Anyone will be able to view or subscribe to the calendar, but a password will be need to make changes.

After creating a phpMyCal, get out of the admin screen by using the “return” link. Now you can access your new editable calendar by using the normal pull-down selector on the right hand side of the screen. When a phpMyCal calendar is selected you will see links at the top right hand side that will allow you to create and edit individual entries and to do items. The password that this add/create screen asks for is the calendar password, if you enabled one, not the phpMyAdmin password. Pretty wicked, eh!?

To finish off the exercise click on the subscribe link when the phpMyCal is up and the iCal application will come up and allow you to subscribe to this calendar. Again, you won’t be able to make edits from iCal, but you will be able to see all of the events.

I’ll leave you with a final note that if you want to password protect read access to these calendars you’ll want to use WebDAV realms, much like we discuss in the phpiCalendar article.