This readme file is for setting up web UI developed by ESRU.
1. Install third party WAMP, LAMP or MAMP stack. Development at ESRU has been done using Ampps and xampp. There are no known issues with these stacks so these are recommended with preference given to xampp which has been found better regarding backwards compatibility and stability. You may be prompted for a user name and password for the MySQL root user. Substitute the details you choose here for "user" and "password" in steps 8 and 9.

2. After installing the stack add the following lines to the apache/conf/httpd.conf file
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

3. To ensure your computer (server) is not world viewable copy the following lines into the file apache/conf/httpd.conf in the text section labelled <Directory /> or equivalent on Linux computers
  Order deny,allow
  Deny from all
  Allow from 127.0.0.0/255.0.0.0 ::1/128
  Allow from your.IP.address.here
  Allow from any.other.IP.addresses
After making this change you may not be able to browse to localhost (although the 127.0.0... line above should allow you to do so) so you may have to explicitly type in your computer’s IP address instead

4. In the php/php.ini file make sure
  file_uploads is set to on
  upload_max_filesize = 32M (or more if you plan to upload bigger projects)

5. Within the ?AMP stack (re)start apache and sql servers to ensure the top three changes are effective.

6. If you were not prompted for username at step 1 then navigate to localhost/phpmyadmin from within an internet browser and create a user with credentials as described in step 1.

7. Within this distribution you have a folder named APASS. Copy it to the xampp/htdocs or ampps/www folder or other folder based on whichever stack you installed at step 1.

8. There should be an SQL dump file called APASS.sql in the distribution as well. Create an empty database called "APASS". You may do this by opening a command line interface (CLI) such as DOS prompt on Windows OS or bash shell on Linux/Mac OS. Change directory to ampps/mysql/bin or xampp/mysql/bin and issue the command (remove .exe for Linux/Mac):
  mysql.exe -uuser -ppassword
This should take you to the mysql command line prompt, issue the commands:
  CREATE DATABASE APASS;
  exit
This takes you back to the bash or DOS CLI.

9. Populate this database by issuing the command:
  mysql.exe -uuser -ppassword APASS < [path to ]APASS.sql
(remove .exe for Linux/Mac).

10. You may use the root SQL credentials (as entered in step 1 or 6) to allow APASS to communicate with the database, but it is recommended to create a dedicated user with limited permissions in the interest of security. To do this, open the MySQL prompt as in step 8, and enter the following commands:
  CREATE USER new_username@% IDENTIFIED BY 'user_password';
  GRANT SELECT, INSERT, UPDATE, DELETE
  ON APASS.* TO new_username@%;
  exit
There are two places you need to manually enter in the MySQL credentials:
1. at the top of "APASS/Pages/stuff.php", and
2. in the .SQL.txt file when setting up the back-end service in step 13.
If you do not create a dedicated user, you must enter the credentials you chose for the root user in step 1 or 6.
The '%' in the user specification means the user can connect from any IP address. If you wish further security, you can create one user for the front-end with 'localhost' instead of '%' (credentials for this user go in stuff.php), and another user for the back-end using the IP address where you install it (credentials for this user go in .SQL.txt).

11. You should now be able to view the interface in a browser at the address localhost/APASS.

12. By default linkage to a BEMServer (https://github.com/HIT2GAP-EU-PROJECT/bemserver) is not enabled. This can be enabled by getting a security certificate from the BEMServer provider and copying into the Pages directory. You will then need to replace "uos_bps.keycrt.pem" with the name of your certificate, and replace the url "https://h2g-platform-core..." with your platform url, in Pages/save_to_portal.php.

13. Before the assessments will work you need to set up the back-end, by following instructions provided in the APASS_backend_readme file.