I’m not sure how niche this need is but I was in need of making a quick website and then suddenly needed a quick but robust web form tool. I I thought for sure I had written at least a blog or two about this awesome tool at formtools.org but apparently I have not. I deeply apologize to all the folks and contributors of this awesome and free and open software project. This is indeed the ‘swiss army knife’ of web form tools and I would love to write more about it one day.
For now, I will simply map out how I got the tool working for this specific need.
Disclaimer: I am an untaught system administrator meaning “I learn as I go’ so if there is a better way to do this, cool. I just search a solution and figure it out as I go until it works and improve as I go.
More precise disclaimer:
If you run this tutorial and set it up like I did, keep in mind you will have to back up the hard files and database SEPARATELY of course since this thing has nothing to do with WP and runs by itself. So if you change servers, upgrade WP etc, it will probably wipe it out since it’s in the same directory. Who knows. Probably this ‘forms’ directory we’re creating should live in a totally separate directory outside of WordPress (“WP”) and then have a separate configuration file created in /etc/apache2/sites-enabled/ directory and point to the root that way. However, I just needed it up and going for now so I stuck it in the /var/www/html directory where the rest of WP was functioning perfectly.
Before you begin
- This assumes you are running an ubuntu server for your WP install
- You have your super user sudo user (or higher) at your server
- You already have your WordPress site up and running.
Get Formtools Zip File on Local Machine
- Install ‘unzip’ tool on your ubuntu server with:
sudo apt install unzip
- Download the most recent Formtools zip file from here somewhere on your local machine. I tried to
curlit there. I tried to
wgetit there, and many other attempts but seemed to keep failing. Hence this method. It seems
sftpcomes installed on most ubuntu installs which is a great tool – I didn’t even know about before I wrote this post.
- On your local machine, with command line, navigate to directory where your downloaded formtools zip file is located with
Put the Formtools Zip File on your Ubuntu Server
You can do this with FTP client or whatever method you like but I really like this sftp tool… quick and easy, works just like ssh.
- In directory where zip file is, connect to WP ubuntu server:
- Enter password
- Put zip file on server (goes to home directory):
put FormTools3.0.20-20191109.zip(of course adjust filename if it’s different)
Should print out something like this:
sftp> put FormTools3.0.20-20191109.zip Uploading FormTools3.0.20-20191109.zip to /home/sysmin/FormTools3.0.20-20191109.zip FormTools3.0.20-20191109.zip 100% 8995KB 753.7KB/s 00:11
- Type ‘exit’ to get out of sftp thing
Setup Your WP Ubuntu Server for Formtools Installation
- ssh into your WP server:
- Move to your WP directory:
- Create a directory name where your forms will live. NOTE: Make this directory name logical since your forms will have this URL in it. In this case I chose ‘forms’ as the name but do what you feel is best:
sudo mkdir forms
- Move back to your home directory on server where your uploaded .zip file shold be sitting
- Move the zip file to the new directory you made in the midst of your WP install directory:
sudo mv FormTools3.0.20-20191109.zip /var/www/html/forms
- Go there to make sure it made it there:
- Assuming it made it there, unzip it there:
sudo unzip FormTools3.0.20-20191109.zip
- Print what you have in the directory to see that you have both the original Formtools zip file and the newly extracted non-zip version:
- Remove the original Formtools zip file as you shouldn’t need it again:
sudo rm FormTools3.0.20-20191109.zip
- Get rid of the Formtools directory (a bit long) and move all the files within, one level up into our custom-created ‘forms’ folder where we currently are. This command says, with the * asterisk, ‘move everything in the formtools directory to the /var/www/html/forms directory.
sudo mv -v formtools/* /var/www/html/forms/
- Everything should now be good. Might as well wipe away the now-empty ‘formtools’ directory:
sudo rmdir formtools
Assuming you did everything here you should now be able to go to your domain name where your WP is installed ‘yourdomain.com/forms’ in a browser and be greeted with the install script page for Formtools. From there you’ll have to do your own study on this great tool but hope this helps.
Setting Correct Permissions
After running the pre-flight stuff for the first time I got notified that the ‘upload’ and ‘cache’ directories did not have write permissions. I’m not sure if this will happen to you so I thought I should log it for all of us:
- Set the owner of the newly created ‘forms’ directory to ‘www-data’ (adjust as you need). the -R sets the owner down the whole directory:
sudo chown-R www-data:www-data /var/www/html/forms/
- Assign the correct permissions to the same directory:
sudo chmod -R 755 /var/www/html/forms/
For full disclosure the first time I did these commands I had issues with permissions. However, after messing with permissions again and running exactly as per above, it started working so my theory is that I goofed something in those first commands. If you run into headaches, try assigning permissions again to the main forms folder separately with
sudo chmod 755 /var/www/html/forms/ (assuming you are in the html directory when you run it) and then again with the -R
sudo chmod -R 755 /var/www/html/forms/. At one point I put the dash in front of the 755 and yeah… don’t do that. HA!
Create the MariaDB Database
Go figure! I thought this thing was going to magically auto-create me a data base but it looks like no such joy shall be mine. Good thing is that I already suffered the pain of learning how to create a database with MySQL so I’ll plop those instructions here and follow them again:
I thought that WP would come with Mariadb version of mysql but it does not. It’s some other version but some of the commands still work.
- Log in to mysql:
sudo mysql -u root -p
- Enter password: .. I used my Digital Ocean’s sudo user’s password / root user and it seemed to work. What are the odds? woot woot. If you are on a different system you’ll probably have to walk the the setup of a secure mysql admin user/password.
Now I’ll try to create my database with the database name that I already saved to my password manager above. I’ll call the database ‘forms_db’ :
- Create database with database name ‘forms_db’ (you can call it what you’d like):
CREATE DATABASE forms_db;
- Ceate the user and password for the database replacing username and password in the following code with yours between the apostrophes:
CREATE USER 'username_here'@'localhost' IDENTIFIED BY 'new_password_here';
On MariaDB I used to do this, but apparently WP comes with some other MYSQL thing and this next command does NOT work:
GRANT ALL ON forms_db.* TO 'username_here'@'localhost' IDENTIFIED BY 'same_password_here' WITH GRANT OPTION;
- I searched online and found this which ultimately worked whatever version of mysql WP uses:
GRANT ALL ON forms_db.* TO 'username_here'@'localhost;'
got this response which ultimately seemed to indicate it worked:
‘Query OK, 0 rows affected (0.00 sec)’
- Flush it like you mean it:
- Get outta dodge:
yay. got outta dodge…
Finishing Install of Formtools
Now, back to the Form Tools install (yourdomain.com/forms) page now that I have some database user stuff to enter. Here is what I stuck in there, mainly leaving the defaults:
1. Enter Formtools Stuff
database hostname: localhost datbasename: forms_db port: 3306 Database username: 'username_here' Datbase password: 'same_password_here' Database table prefix: ft_
2. Accept config file
The next screen ‘Create Config File’ seems to be a friendly heads up that it will automatically create the config file based on the info you are submitting. I will accept their friendly offer and click ‘create file’ button.
This went well too.
3. “Create Admin Account”
This part is to give your admin user power over the tool box, much like your wordpress main admin user. Nothing complicated here, fill in the username and password stuff and save credentials safely in your password manager or on the sticky note beside your monitor like most people, har har.
4. Finish up
I got a ‘Clean Up’ message with a ‘Congratulations, Form Tools has been successfully installed!’ so that’s also looking good.
There is a green “log into Form Tools’ button that appears. After clicking it I was greeted with user / password fields and I used the credentials we just created above which successfully logged me in.
Don’t forget my disclaimer at the top. I’m not a qualified system admin. I’ll therefore paste this warning again so you can plan accordingly and adjust:
If you run this tutorial and set it up like I did, keep in mind you will have to back up the hard files and database SEPARATELY of course since this thing has nothing to do with WP and runs by itself. So if you change servers, upgrade WP etc, it will probably wipe it out since it's in the same directory. Who knows. Probably this 'forms' directory we're creating should live in a totally separate directory outside of Word Press and then have a separate configuration file created in /etc/apache2/sites-enabled/ directory and point to the root that way. However, I just needed it up and going for now so I stuck it in the /var/www/html directory where the rest of WP was functioning perfectly.
The next part is learning how to use form tools which isn’t super intuitive the first round but very powerful. I hope to do a series on this one day but for now hopefully this helps someone.
Have a great day!