ELS Howto: PHP iCalendar


Synopsis

This document explains how to display an iCalendar file as a web calendar using PHP iCalendar on an Elemental Linux Server (ELS) system.


Prerequisites

These instructions assume that you have a working PHP-enabled web server with WebDAV configured for calendar sharing. If you do not, see the ELS Howto: Apache and PHP and the ELS Howto: Sunbird Shared Calendars before beginning this document.


Installation

Installation instructions for PHPiCalendar are available on the PHPiCalendar web site. This document will guide you through the specifics of installing it with the calendar upload directory used in the ELS Howto: Sunbird Shared Calendars.

  1. Download the latest version of PHPiCalendar from http://phpicalendar.net/ and extract it into your web server's document root directory.
  2. Create a symbolic link with the name of your calendar that points to the phpicalendar-X.y directory.

Example

The following example shows how you would install PHPiCalendar if your web server document root were /home/httpd.

cd /home/httpd
wget http://downloads.sourceforge.net/project/phpicalendar/phpicalendar/
  phpicalendar%202.4%20RC7/phpicalendar-2.4_20100615.tar.bz2
tar --no-same-owner -jxf phpicalendar-2.4_20100615.tar.bz2

ln -s phpicalendar-2.4 calendar

Configuration

Configuration of PHPiCalendar is minimal. All that is needed is to set the location of your calendar file and to verify that the PHP date.timezone parameter is correct.

  1. Edit the config.inc.php configuration file and change the calendar path to the directory that you configured to hold calendars in the ELS Howto: Sunbird Shared Calendars
  2. Comment out the $list_webcals array items in config.inc.php
  3. Edit /etc/opt/php/php.ini and verify that the date.timezone parameter is set correctly for your region

Example

This example shows how you would change config.inc.php for a calendars directory of /home/httpd/upload/calendars and set the timezone for U.S. Central.

vi /home/httpd/phpicalendar-2.4/config.inc.php
'calendar_path'        => '/home/httpd/upload/calendars',

$list_webcals = array(
#       'webcal://dimer.tamu.edu/calendars/seminars/Biochem.ics'
#       'webcal://calendar.sxsw.com/iCal-EXDrB-sa-sxsw@rollerfeet.com.ics'
);

vi /etc/opt/php/php.ini
date.timezone = "America/Chicago"

Testing

Add an appointment to your calendar using Sunbird and publish it to your web server. Verify that the appointment appears when you open the calendar URL in a web browser.

If the appointment does not appear as expected, follow the troubleshooting steps below:

  1. If the wrong date is displayed, verify the php.ini timezone setting and send a HUP signal to Apache if changes were made.
  2. If a demo calendar is displayed instead of your calendar, verify that the config.inc.php file has been updated to point to your calendar directory.
  3. Follow the troubleshooting steps at the end of the Sunbird Shared Calendars

You may also want to consult the PHPiCalendar documentation wiki at http://phpicalendar.net/documentation/index.php/Main_Page