PHPiCalendar Install tutorial



I’d been pretty regularly getting questions on how to set up PHPiCalendar, so I finally went and created this step-by-step guide for Dreamhost users. Enjoy, and let me know what y’all think.


Thanks for doing the tutorial!

A couple of comments -

o) PHP as CGI seems to be working fine for me. [Hadn’t seen that recommendation before I installed.]

o) The “chmod -R 755” may have been needed at one point, but I skipped that step with apparently no ill effects. [Have a predisposition to being conservative in file permissions and since many of the files didn’t need x access, I tried without the chmod and went from there.]

o) After creating a new calendar file with Sunbird or Apple’s iCal, the file has permission 640 and it apparently needs to be 644. The only way I’ve found around that is to turn off WebDAV in the directory, “chmod 644 newfile.ics”, and then change back to WebDAV. Since this problem apparently comes from the client and I don’t think there are any configuration options on WebDAV, I can’t find where I might have misconfigured something. Or is it just that, as a WebDAV newbie, I’m completely missing something obvious? [I realize this isn’t a PHPiCalendar problem, but was wondering if it might be Dreamhost specific or otherwise need a note in the instructions.]

PHPiCalendar was pretty straightforward to install (and would have been even easier with your tutorial!) and seems better than the webcalendar that the DH folks just added to the one-click install menu.

Thanks, again!


[quote][Hadn’t seen that recommendation before I installed.]
Glad its working for you, but everything I’ve read has implied that PHPiCalendar can’t run as a CGI because of permission problems.

Again, glad you’re okay, but I think this is a good thing to do in principle.

This is a weird one - I haven’t experienced this problem. I didn’t specify any WebDAV options, since there aren’t any to specify, really, other than the username and pw. Strange. Anyone else seen this?


Thank you for the tutorial! I’ve used all of your suggestions, except the last one about hiding the errors. I will do that after I figure out why the “year” view doesn’t work. Do you have any suggestions for how to fix this? The calendar is at and the error appears at


After your turned WebDav back on and after Sunbird or iCal updated the .ics file, can you still access the file with PHPiCalendar? I was unable.

First 2 steps worked great. I even saw the calendar working. But once I updated the .ics file all failed. Looks like the file permisions were changed back after WebDav was turned back on.

any idea?



No idea why your “year view” is dead. The error is gives is rather interesting; an “unsupported operand type” is a new one to me. I’d try posting in the PHPiCalendar forums and see what they’ve got. Also, version 2.2 will be out any day now, and hopefully that’ll fix some errors also. Sorry I can’t help. :frowning:


Yeah, I’ve never had a problem updating my calendars. I’ve use both Sunbird (on a PC and a Mac) and iCal (on a Mac, of course) and they both seem to work okay for me. Reviewing the premissions on my .ics files, they look like:

-rw-r----- with dhapache as the owner.

My guess is maybe PHP is running as a CGI and therefore can’t read your calendar because of permission problems (i.e. dhapache and yourusername are not in the same group, which is likely)? Other than that, I dunno. :frowning: Sorry.



I think I’m seeing this problem with permissions too. Just tried installing. Everything works fine until I upload a calendar (using Sunbird), at which point I get an error that the calendar can’t be read, I guess because I don’t have permission. Anybody have any ideas?


Hmmm…I might have made a mistake in my install instructions. Oh no…

Try unchecking the “password protect this dir?” option in the WebDAV settings for your directory and see if that fixes the problem. I’ll try to experiment on my own also.


The permissions are probably the problem. If you are using WebDAV, then owner of the webdav directory and all the files in it is dhapache, and the group is dhapache – the web server’s user – and the permissons on files are rw-r-----, so only that user and that group can read it. That’s fine if you are simply serving the files; the web server runs as that user and so it can show them.

However, if you are running PHP as CGI, the CGI program runs with your user ID, and so it doesn’t have permission to read the file.

If you switch off “Run PHP as CGI” in the control panel, then the PHP code is running inside the web server and has all the permissions of dhapache, and it can see the file, so then phpiCalendar will work again.

Unfortunately that means some other PHP applications won’t work, at least according to the wiki. On thought I had was to specify the calendar as being on the web (just listing it with http://path/to/your/ics/file in the config file) since then it’d be visible, but loading URL’s with fopen is turned off, apparently. I haven’t looked into it any further.


Any update on this? I just tried to install it myself and ran into the same trouble others are reporting with PHP as CGI enabled and my webdav password-protected.

A couple things:

-I want to leave PHP as CGI enabled. I have other apps that will probably break without it. Plus it seems to have security benefits.
-I want to have a webdav username/password. I don’t feel comfortable with a wide-open webdav directory on my server.

So, how can we run phpicalendar with PHP as CGI and webdav passwords?



So, I found a workaround. I’m using the publish.ical.php method instead to publish from my Mac’s iCal. This does not work in the normal methods with dreamhost, but the solution is using mod_rewrite as explained here:

I’d still prefer to use webdav though.


Glad you got it working. I know that the main source of problems that people have with the application is the publish.*.php page, so I didn’t use that in the wiki instructions. It’s funny, I upgraded to the latest beta of Sunbird and now I appear to be having the same permissions problem as everyone else. Darn alpha software! Serves me right.

I haven’t had time to experiment with the publishing scripts, but if they do work, I’ll be happy to update the wiki (if you haven’t yet, carlivar ;).


Sorry not to have checked this thread, but yes, everything’s been working fine.

The ics files are owned by dhapache/dhapache with mode 644.

I’m using Sunbird v0.3a1, which is, apparently, still current.

And one more bit - I can no longer find the “run PHP as CGI” box to uncheck in the panel. Again, it’s been working fine for me, but was there any announcement that the option was going to be disabled?


This thread
explains the missing “run as CGI” option.


I wanted to thank you for your wiki tutorial on setting up phpicalendar. I got it working no problem.

I did have a question though. I would like the public to be able to use iCal (or whatever iCal compatible program they are using) to subscribe to the calendar. The way Dreamhost has it set up, you have to have the username and password in order to subscribe which make the whole password protect thing pointless. I came across this tutorial a while ago and got it to work on my local Mac. Can you think of an easy way to replicate it on Dreamhost’s system? I tried it (the stuff on the second page) and couldn’t get it to work.

Thanks in advance.