# Install and Configure DaviCal

## crowbert

I just upgraded www-apps/davical to the new 1.1.7 today, and it broke things.  In the process of fixing things, I cleaned up a bunch of other stuff that I stumbled into, but I wanted to report here for anyone having problems.

I wasn't sure what the problem was.  Thunderbird reported error 80040111, which is apparently a login error of some sort.

I tried upgrading PHP from 5.6 to 7.2.1.  Everything that I could find indicated that davical should be happy with both versions.  That was correct.  I had exactly the same problems with both.  While 7.2.1 works fine after fixing other issues (see below), I'm confident that 5.6 also works just fine.

I checked to see if I needed to upgrade postgresql.  I have both 9.6 and 10.1 installed, but I'm running 9.6.  Everything indicated that this shouldn't be an issue, so I'm sticking with 9.6 after I confirmed from the command line that I could read entries from the database.

I ran the command to update the davical database:

```
/usr/share/webapps/davical/1.1.7/sqlscripts/update-davical-database
```

That ran fine (also confirming that postgres is working correctly).

It boiled down to error messages in the web server log:

```
[Wed Jan 17 18:43:51.582725 2018] [php7:warn] [pid 6564:tid 140717168518912] [client 10.1.1.118:49678] PHP Warning:  require_once(Principal.php): failed to open stream: No such file or directory in /var/www/localhost-81/htdocs/always.php on line 284

[Wed Jan 17 18:43:51.582766 2018] [php7:error] [pid 6564:tid 140717168518912] [client 10.1.1.118:49678] PHP Fatal error:  require_once(): Failed opening required 'Principal.php' (include_path='../inc:/usr/share/php/awl/inc:.:/usr/share/php7:/usr/share/php') in /var/www/localhost-81/htdocs/always.php on line 284
```

As you can see, I have a vhost set up on port 81 just for davical, and it's installed in /var/www/localhost-81/.

Getting this to work required two steps.  The first is using webapp-config to install it.  I used the 'vhost' USE flag when emerging davical, or I think it would have installed it automatically in the default /var/www/localhost/ directory.

```
webapp-config -h localhost-81 -d . -I davical 1.1.7
```

I could go on with a long rant on how poorly documented webapp-config is, but I'll just explain my understanding of what the above syntax means:

```
webapp-config -h [dirname under /var/www/] -d [dirname under htdocs] -I [package name] [version]
```

So in my example, it's installing most stuff in /var/www/localhost-81/htdocs/.  The '-d' is important because I don't want an extra '/davical/' in the calendar URL (which is why I used a vhost to put it on its own port).

But that didn't fix the problem.  The file it's looking for is installed, but it couldn't find it:

```
/var/www/localhost-81/davical/inc/Principal.php
```

The solution was to create some symlinks based on the path in the error message.  This shouldn't be necessary, and it says to me that either there's a bug in an ebuild (my guess), or there's something configured wrong on my system (entirely possible):

```
cd /var/www/localhost-81

ln -s davical/* .
```

So there we have it.  A restart of Apache, here and there (when updating vhosts and PHP configurations), and it all works.

Hopefully this will help anyone else with similar issues.  If someone understands the subtle details as to why I had to put in the manual symlinks, please explain.

----------

## joeha

Sorry for necromancing, this is just for the records in case someone got a similar problem.

I did upgrade from davical-1.1.3.1-r2 to davical-1.1.9.3 and had the same problem.

A scan of the apache error log showed

```
PHP Fatal error:  require_once(): Failed opening required 'Principal.php' (include_path='../inc:/usr/share/php/awl/inc:.:/usr/share/php7:/usr/share/php') in /var/www/localhost/htdocs/davical/always.php on line 326

```

The include path points to /var/www/localhost/htdocs/davical/../inc which does not exist. But I did find the file in /var/www/localhost/davical/inc/Principal.php

So I did not want to change the web installation with soft links, changing the include path seemed a better idea. 

In /etc/davical/config.php I added the line

```
set_include_path( '/var/www/localhost/davical/inc'. PATH_SEPARATOR. get_include_path());

```

Works for me. Hope to help people with similar problems.

----------

