The [https://www.fact-project.org/viewer/ Event Viewer] is a tool which allows to display raw data and manipulate raw data from a web browser. It is ideal to develop new algorithms without recompiling any code or writing a new framework. The disadvantage is that it is quite tedious to install. Here are some instructions.
== Requirements ==
== PHP ==
You need php installed. Otherwise, you will not be able to run the event viewer. In Ubuntu this is the package `php`.
== Getting FACT++ ==
First, you need to checkout FACT++ to get the tool `getevent`:
{{{
[0] scn checkout https://www.fact-project.org/svn/FACT++
}}}
Instructions how to compile FACT++ can be found here: InstallingFACT++. Compiling it with the TOOLS_ONLY option is enough. The web source code of the viewer is located now in FACT++/www/viewer.
== V8 ==
To run the viewer, you need the V8 JavaScript engine installed. To be moe precise, you need the libraries and the development package (headers). A version of at least 5.6 is required. As most recent distributions ship with an older version. Tif you system uses apt (e.g. Ubuntu) you can check with
{{{
[1] apt list | grep libv8
libv8-3.14-dbg/xenial 3.14.5.8-5ubuntu2 amd64
libv8-3.14-dev/xenial 3.14.5.8-5ubuntu2 amd64
libv8-3.14.5/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed,automatic]
libv8-6.4/xenial 6.4.388.18-ppa1~xenial amd64
libv8-6.4-dbg/xenial 6.4.388.18-ppa1~xenial amd64
libv8-6.4-dev/xenial 6.4.388.18-ppa1~xenial amd64
libv8-6.5/xenial 6.5.144-ppa1~xenial amd64
libv8-6.5-dbg/xenial 6.5.144-ppa1~xenial amd64
libv8-6.5-dev/xenial 6.5.144-ppa1~xenial amd64
libv8-6.6/xenial,now 6.6.313-ppa1~xenial amd64 [installed]
libv8-6.6-dbg/xenial 6.6.313-ppa1~xenial amd64
libv8-6.6-dev/xenial,now 6.6.313-ppa1~xenial amd64 [installed]
libv8-dev/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed]
}}}
To install a newer version, you can either compile your own version (https://v8.dev/) or install some community maintained package. Here is an example:
{{{
[2] sudo add-apt-repository ppa:pinepain/libv8
[3] sudo apt-get update
[4] sudo apt install v8-6.6 v8-6.6-dev
}}}
This will install the headers and libraries into `/opt/libv8-6.6`.
== V8Js ==
Now you need the module which enables php to run V8Js (https://github.com/phpv8/v8js). Detailed installation instruction can be found in the README*.md files (Linux instructions: https://github.com/phpv8/v8js/blob/php7/README.Linux.md).
If you have root rights, the easiest is to use pecl to install V8Js:
{{{
[5] sudo pecl install v8js
}}}
It will ask you for the installation directory of v8. In this example it is /opt/libv8-6.6.
Without root rights, the best is to do it also through pecl but locally:
{{{
[5] pecl bundle v8js
[6] cd v8js
[7] phpize
[8] ./configure --with-v8js=/opt/libv8-6.6
[9] make
}}}
You should now have a file `modules/v8js.so` in the v8js directory.
== Local web-server ==
You can use a system web-server (apache2), but it might be difficult to configure. Some instruction will follow at the end of this document.
The easiest is to run a local web-server in user space. Fortunately, php comes with its own web-server exactly for this purpose. Its manual is available here http://php.net/manual/en/features.commandline.webserver.php.
Start it in the veiwer directory with
{{{
[10] cd FACT++/viewer
[11] php -S localhost:5000
}}}
The viewer should now be accessible in your browser as `http://localhost:5000/index.html`.
If you get an error that V8Js is not properly installed, you might need to create a file `php.ini` with the following contents
{{{
extenstion=v8js.so
}}}
If that does not work, you might have to use an relative or absolute path to `v8js.so`.
Start your web-server now with
{{{
[10] cd FACT++/viewer
[11] php -S localhost:5000 -c php.ini
}}}
Now your viewer should load without an error.
== Apache/2 ==
If you want to use a global web-server, you can install `apache2`, `php` and `libapache2.mod-php`.
Usually, the default directory for user web-content is /home/user/public_html. When you think you have identified where you can put web-contents, I suggest to test if everything works properly.
Put a file `info.php` with the following contents there.
{{{#!php
}}}
Now, open your browser and browse that file through your web-server, e.g. `http://localhost/~user/info.php`. If you see the contents of the file, you still have to work on your configuration. If you see some nice table with php information, everything is ok.
In newer Ubuntu versions, php for local directories is turned off. You need to enable it by commenting the follwing in `/etc/apache2/mods-enabled/php7.0.conf`
{{{
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from to .) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#
#
# php_admin_flag engine Off
#
#
}}}
Then you have to configure apache to use the new extension by adding `extension=v8js.so` to your `php.ini` (in Ubuntu it is found at /etc/php/7.0/apache2/php.ini).
Now, reload the apache configuration
{{{
[5] sudo service apache2 reload
}}}