# Changes between Version 1 and Version 2 of InstallingEventViewer

Ignore:
Timestamp:
Nov 10, 2018, 9:45:34 PM (4 months ago)
Comment:

--

Unmodified
Added
Removed
Modified
• ## InstallingEventViewer

 v1 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. First, you need to checkou FACT++: == 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: {{{ }}} Instructions how to compile FACT++ can be found here: InstallingFACT++. Compiling it with the TOOLS_ONLY option is enough. 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. Now, you need to make sure that a web-server is installed, PHP is installed and the corresponding web-server configuration is set. For Ubuntu that means installing apache2, php and libapache2.mod-php. == 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. }}} The next challenge is to get V8Js running, the V8 interface for PHP. You can use pecl to install it: {{{ [1] sudo pecl install v8js }}} You will see some downloads and how pecl tries to configure the compilation. As V8Js requires a quite recent V8 library and current systems still come with a rather old one, you might see an error like this: {{{ checking for libv8_libplatform... configure: error: could not find libv8_libplatform library ERROR: /tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js' failed }}} if this is the case, you need to install a recent version of V8. In case of Ubuntu (>=16.04), you can do that with {{{ [2] sudo add-apt-repository ppa:pinepain/libv8 [3] sudo apt-get update [4] sudo apt install v8-6.6 v8-6.6-dev }}} You need to install the libraries and the developer files. Now you can run ![1] again providing the correct installation path (in the case of the PPA, this is /opt/libv8-6.6) and everything should run through. 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). [5] sudo service apache2 reload }}} I sugget to like the viewer directory in your public_html directory, e.g. {{{ [6] cd ~/public_html [7] ln -s [your-FACT++-directory]/www/viewer }}} You should now be able to access the viewer from your web-browser as http://localhost/~user/viewer/. Ideally without getting an error (except that no files could be found) If that goes well, as a last step, you have to change the path to the FACT++ tool getevent` and the paths to your data. As you will most likely only want to display raw data (Monte Carlo data and calibrated data needs special preparation), just add the path to your raw data three times.