11 | | 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`. |
| 19 | == V8 == |
| 20 | |
| 21 | 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 |
| 22 | |
| 23 | {{{ |
| 24 | [1] apt list | grep libv8 |
| 25 | |
| 26 | libv8-3.14-dbg/xenial 3.14.5.8-5ubuntu2 amd64 |
| 27 | libv8-3.14-dev/xenial 3.14.5.8-5ubuntu2 amd64 |
| 28 | libv8-3.14.5/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed,automatic] |
| 29 | libv8-6.4/xenial 6.4.388.18-ppa1~xenial amd64 |
| 30 | libv8-6.4-dbg/xenial 6.4.388.18-ppa1~xenial amd64 |
| 31 | libv8-6.4-dev/xenial 6.4.388.18-ppa1~xenial amd64 |
| 32 | libv8-6.5/xenial 6.5.144-ppa1~xenial amd64 |
| 33 | libv8-6.5-dbg/xenial 6.5.144-ppa1~xenial amd64 |
| 34 | libv8-6.5-dev/xenial 6.5.144-ppa1~xenial amd64 |
| 35 | libv8-6.6/xenial,now 6.6.313-ppa1~xenial amd64 [installed] |
| 36 | libv8-6.6-dbg/xenial 6.6.313-ppa1~xenial amd64 |
| 37 | libv8-6.6-dev/xenial,now 6.6.313-ppa1~xenial amd64 [installed] |
| 38 | libv8-dev/xenial,now 3.14.5.8-5ubuntu2 amd64 [installed] |
| 39 | }}} |
| 40 | |
| 41 | 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: |
| 42 | |
| 43 | {{{ |
| 44 | [2] sudo add-apt-repository ppa:pinepain/libv8 |
| 45 | [3] sudo apt-get update |
| 46 | [4] sudo apt install v8-6.6 v8-6.6-dev |
| 47 | }}} |
| 48 | |
| 49 | This will install the headers and libraries into `/opt/libv8-6.6`. |
| 50 | |
| 51 | == V8Js == |
| 52 | |
| 53 | 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). |
| 54 | |
| 55 | If you have root rights, the easiest is to use pecl to install V8Js: |
| 56 | |
| 57 | {{{ |
| 58 | [5] sudo pecl install v8js |
| 59 | }}} |
| 60 | |
| 61 | It will ask you for the installation directory of v8. In this example it is /opt/libv8-6.6. |
| 62 | |
| 63 | Without root rights, the best is to do it also through pecl but locally: |
| 64 | {{{ |
| 65 | [5] pecl bundle v8js |
| 66 | [6] cd v8js |
| 67 | [7] phpize |
| 68 | [8] ./configure --with-v8js=/opt/libv8-6.6 |
| 69 | [9] make |
| 70 | }}} |
| 71 | |
| 72 | You should now have a file `modules/v8js.so` in the v8js directory. |
| 73 | |
| 74 | == Local web-server == |
| 75 | |
| 76 | 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. |
| 77 | |
| 78 | 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. |
| 79 | |
| 80 | |
| 81 | Start it in the veiwer directory with |
| 82 | {{{ |
| 83 | [10] cd FACT++/viewer |
| 84 | [11] php -S localhost:5000 |
| 85 | }}} |
| 86 | |
| 87 | The viewer should now be accessible in your browser as `http://localhost:5000/index.html`. |
| 88 | |
| 89 | If you get an error that V8Js is not properly installed, you might need to create a file `php.ini` with the following contents |
| 90 | {{{ |
| 91 | extenstion=v8js.so |
| 92 | }}} |
| 93 | |
| 94 | If that does not work, you might have to use an relative or absolute path to `v8js.so`. |
| 95 | |
| 96 | Start your web-server now with |
| 97 | {{{ |
| 98 | [10] cd FACT++/viewer |
| 99 | [11] php -S localhost:5000 -c php.ini |
| 100 | }}} |
| 101 | |
| 102 | Now your viewer should load without an error. |
| 103 | |
| 104 | == Apache/2 == |
| 105 | |
| 106 | If you want to use a global web-server, you can install `apache2`, `php` and `libapache2.mod-php`. |
40 | | The next challenge is to get V8Js running, the V8 interface for PHP. You can use `pecl` to install it: |
41 | | |
42 | | {{{ |
43 | | [1] sudo pecl install v8js |
44 | | }}} |
45 | | |
46 | | 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: |
47 | | |
48 | | {{{ |
49 | | checking for libv8_libplatform... configure: error: could not find libv8_libplatform library |
50 | | ERROR: `/tmp/pear/temp/v8js/configure --with-php-config=/usr/bin/php-config --with-v8js' failed |
51 | | }}} |
52 | | |
53 | | 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 |
54 | | |
55 | | {{{ |
56 | | [2] sudo add-apt-repository ppa:pinepain/libv8 |
57 | | [3] sudo apt-get update |
58 | | [4] sudo apt install v8-6.6 v8-6.6-dev |
59 | | }}} |
60 | | |
61 | | 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. |
62 | | |