Using the PHP code: prerequisites and installation

You need to install some stuff on your server in addition to all prerequisites for LARA local installation. Everything is free.

PHP

If you don’t already have PHP installed, install it now.

You will need PHP packages for curl (php7.2-curl or similar) and mbstring (php7.2-mbstring or similar), which probably won’t be installed by default.

XAMPP or Wamp

Download and install XAMPP or Wamp according to your server. Our recommendation is XAMPP since it’s easier to install and also works on multi platforms.

MySQL Workbench

Download and install MySQL Workbench. It’s not essential. You can easily use phpMyAdmin. It just makes the SQL part of work easier for you.

Portal database

Create ‍‍‍‍‍`LARA-portal` database on your server and then, create all LARA tables by importing the exportLaraPortalDB.sql in your schema. If you are using phpMyAdmin, you can easily upload this file in the import tab.

Portal structure

For working with LARA, you need to have three separate directories:

Code root directory

In this directory, you copy the LARA code from sourceforge. Let’s call it /codeRoot/LARA-portal. Based on this assumption, the ROOT constant in config file will be defined as /codeRoot/LARA-portal/trunk/Code/PHP/, the PythonDir constant as /codeRoot/LARA-portal/trunk/Code/Python/ and the LaraEnv contant as /codeRoot/LARA-portal/trunk.

Data root directory

This directory is the main repository to store the results of different python calls. If, assumptively, we call it dataRoot, the LaraContentDir constant value should be the same. Some predefined directories should be located in the data root. We mention these directories and their related constant variable below:

  • /dataRoot/WorkingTmpDirectory –> WorkingTmpDirectory

  • /dataRoot/ContentTmpDirectory –> ContentTmpDirectory

  • /dataRoot/ExternalResourceDirectory –> ExternalResourceDirectory

  • /dataRoot/ImportContentsDirectory –> ImportContentsDirectory

Web root directory

For external access to the LARA format contents, a directory inside the web site repository should be defined so that people can have access to the HTML files of texts and words. In our server, it’s called callector. Based on this directory on your own server, please redefine CallectorDir, and the WebRoot constant in the config file. Two predefined directories here are:

  • /webRoot/LaraResourceContent –> DistributedDir

  • /webRoot/LaraReadingHistories –> ReadingHistoryDir

What to change in the config file?

Here, we explain the config file in more detail so that you can change it in the appropriate way.

LaraEnv, TreeTaggerEnv and PythonCmnd are the three constant that we use to run the Python commands via shell_exec. The first one refers to the direction you’ve installed Lara codes, the second one is the directory of TreeTagger, and the latest indicates the version of Python which will run these commands.

LaraDB constant array contains the database connection information and LataLDT constant array contains the LiteDevTools connection information.

In the following lines, we define all constants which are used for the Lara structure part. You probably will change them according to your repository settings.

  • ROOT : PHP codes directory.

  • PythonDir : Python codes directory.

  • LaraContentDir : Data root directory.

  • CallectorDir : Web root directory.

  • PortalReadingHistoryDir : Reading histories storage directory.

  • WebRoot : Root of web address for LARA contents.‍‍

How to run?

Similar to (almost) all PHP projects, you can run the LARA portal with opening index.php file in view folder after copying the whole project in www folder.

Error log

If things go wrong, it is often useful to consult the relevant Apache error log. On the Unige server, this can be found at /var/log/apache2/lara-portal/error.log.

Final note

Please feel free to contact us if you have any questions setting up the LARA portal.