How to install Form Tools on Ubuntu 18.04

Form Tools is a powerful, flexible, free, and open-source PHP/MySQL script you can install on your website for managing your forms and data. It is all about data management. This article takes you through an installation of Form Tools on Ubuntu server 18.04 for testing purposes.

The installation of Form Tools on Ubuntu server 18.04 requires a small action plan:
– Set hostname
– Update system
– Install and configure Apache
– Install and configure MySQL
– Install and configure PHP
– Configure Form Tools

I had some issues with the MySQL statements, caused by using the wrong quotes (this happened somehow during my copy and paste actions).

To set the hostname login with ssh via a terminal server and run the following commands:
$ hostnamectl set-hostname hostname

Add the following line to the hosts file:
$ sudo nano /etc/hosts
127.0.1.1 hostname.domainname.extention hostname

$ sudo reboot now

Next up is updating your system:
$ sudo apt-get clean && sudo apt-get -y autoremove && sudo apt-get -y update && sudo apt-get -y dist-upgrade –fix-missing && sudo sync
$ sudo reboot now

Now we are going to install and configure Apache
$ sudo apt install apache2
$ sudo ufw app list
$ sudo ufw app info “Apache Full”
$ sudo ufw allow in “Apache Full”

Up next is installing and configuring MySQL server
$ sudo apt install mysql-server

To check whether MySQL is up and running (use Ctrl + C to stop):
$ sudo systemctl status mysql

Of course, you want to secure your MySQL database (for testing purposes I chose the lowest password validation policy, be smart use the highest).
$ sudo mysql_secure_installation

Would you like to setup VALIDATE PASSWORD plugin: y
There are three levels of password validation policy: Low
MySQL root password: mysqlrootpassword
Do you wish to continue with the password provided: Y
Remove anonymous users : Y
Disallow root login remotely: Y
Remove test database and access to it: Y
Reload privilege tables now: Y

Next up is adjusting the User Authentication and Privileges in MySQL
$ sudo mysql
SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘mysqlrootpassword’;
FLUSH PRIVILEGES;
SELECT user,authentication_string,plugin,host FROM mysql.user;
exit

Check whether MySQL is up and running (use Ctrl + C to stop):
$ systemctl status mysql.service

Now we are going to create a FormTool user and database (login to MySQL using your mysqlrootpassword)
$ mysql -u root -p
mysqlrootpassword
CREATE USER ‘formtooluser’@’localhost’ IDENTIFIED BY ‘formtooluserpassword’;
GRANT ALL PRIVILEGES ON * . * TO ‘formtooluser’@’localhost’;
SHOW GRANTS FOR ‘formtooluser’@’localhost’;
exit

$ mysql -u formtooluser -p
formtooluserpassword
CREATE DATABASE db_formtools;
exit

Almost there 😉 Installing and configuring PHP
$ sudo apt install php libapache2-mod-php php-mysql

Look for index.php first place index.php upfront in apache’s dir.conf
$ sudo nano /etc/apache2/mods-enabled/dir.conf
$ sudo systemctl restart apache2

Configure Apache for Formtools
$ sudo chown -R $USER:$USER /var/www
$ sudo chmod -R 755 /var/www

Download Form Tools from the website to your computer and upload it to your server.

From your computer:
$ cd Downloads
$ scp ./FormTools3.0.20-20191109.zip root@serveripaddress:~/.

On your webserver check whether the file is there:
$ ls ./Form.

Install unzip
$ sudo apt-get install unzip

Unzip the FormTool package
$ unzip ./FormTools3.0.20-20191109.zip

Move unzipped files to proper folder on your webserver
$ sudo cp -v -r ./formtools/. /var/www/

Check if files moves at all:
$ cd /var/www/
$ ls

Back to home
$ cd~

Cleanup homefolder
$ rm -rf ./formtools

Give Apache write permissions to upload and cache folder:
$ sudo chown -R www-data:www-data /var/www/upload
$ sudo chown -R www-data:www-data /var/www/cache

Change the folder name in the apache config file and restart apache
$ sudo nano /etc/apache2/sites-available/000-default.conf
DocumentRoot /var/www/html
to
DocumentRoot /var/www

$ sudo systemctl restart apache2

After the reboot we will finish the configuration of FormTools using the webbrowser.

In your web browser go to the IP dress of your FormTools server and start the configuration op FormTools:

Welcome
Welcome message > Choose your language

System check
All bullets should be green

Create Database Tables
Database hostname = localhost
Database name = db_formtools
Port = 3306
Database user name = formtooluser
Database password = formtooluserpassword
Database table prefix = ft_

Create config file
The option to let the browser create the config.php didn’t work for me.
So I logged on to the system using my terminal to create the config.php file.

$ sudo nano /var/www/global/config.php

I copied and pasted the text, holding the configuration of the server, from my browser into my nano session in the terminal.

To make sure the server is able to read the file I changed the permissions on the file by:

$ sudo chown -R www-data:www-data /var/www/global/config.php

So back to the browser 🙂

Create Admin Account
First Name = FormToolsAdminFirstName
Last Name = FormToolsAdminLastName
Email = FormToolsAdminEmailAddress
Login Username = FormToolsAdminUserName
Login Password = FormToolsAdminUserPassword
Re-enter Password = FormToolsAdminUserPassword

Clean Up
Login after successful install

Now you are ready to play with the beautiful product Form Tools.

Suggestions for improving this article are welcome, please let me know and drop me a line .