Installing Easy Forms - First steps - Easy Forms

# Installing Easy Forms ¶

Easy Forms installation is a simple process that should not take more than a few minutes. The following installation guide will help you install Easy Forms on your server.

> Note: This guide assumes that you have already uploaded the 'app' folder (Easy Forms files) to your server.

> Recommended: Compress the 'app' folder and upload 'app.zip' file. Then, uncompress the file in your server. With this you will avoid problems (corrupted files) and reduce the upload time.

> Note: @app refers to the application installation path.

## Check the Server Configuration ¶

Before proceeding with your installation, you should review the application's minimum requirements. Most web hosts meet these requirements.

## Add Free GeoLite2 DB files to your server ¶

GeoLite2 databases are free IP geolocation databases and are needed to collect your users' geographical location. Therefore, you must:

1. Download GeoLite2 City and GeoLite2 Country databases.
2. Unzip the files and place them in the directory `@app/components/analytics/enricher/GeoIP`.
3. Verify that the files match these paths:
   - @app/components/analytics/enricher/GeoIP/GeoLite2-City.mmdb
   - @app/components/analytics/enricher/GeoIP/GeoLite2-Country.mmdb

## Set up directory and file permissions ¶

For the application's correct operation you must ensure that some files or directories have the proper permissions:

- Runtime directory: `chmod -R 0777 @app/runtime`
- Assets directory: `chmod -R 0777 @app/assets`
- Static Files directory: `chmod -R 0777 @app/static_files`
- Database configuration file (The install script needs write permission): `chmod 0777 @app/config/db.php`

If the files' owner is the web server. Then, set the file permissions to 0755. For example, if you use an FTP client such as Filezilla:

    1. Open your FTP client
    2. Right-click on 'runtime' directory and click on 'File permissions...'
    3. Write 755
    4. Check 'Recurse into subdirectories' and 'Apply to all files and directories'
    5. Press ok
    6. Repeat the same steps with the 'assets' and 'static_files' directories.
    7. Right-click on the 'config/db.php' file and click on 'File permissions...'
    8. Write 755 and Press ok

> Note: If you have trouble setting permissions, get in touch with our support team and we will be more than happy to help you.

## Prepare the MySQL database ¶

Easy Forms needs a MySQL database to store its data such as forms, submissions and stats. You can either use your existing MySQL database or create a dedicated MySQL database for Easy Forms on your server.

Take note of the username, password, database name, and hostname as you create the database. You will enter this information during the install.

> Important! If you are installing on 'localhost' (on Windows) by Wamp or Xampp, you must import the file 'easy_forms.sql' to your database (The .sql file comes in the 'local' folder attached to this documentation).

## Run the install script ¶

To run the install script, point your browser to 'install.php' file in the base URL of your application (e.g., http://www.example.com/install.php).

You will be guided through several screens to choose your language, set up the database and create the administrator account.

## Verify that the site is working ¶

When the install script finishes, you can go to the application home page and it automatically will show the login form. If the form is not displaying properly and links on the page result in "Page Not Found" errors, you may be experiencing problems with friendly URLs. You must ensure you have the Apache module 'mod_rewrite' enabled.

> Important! If your server doesn't have Apache mod_rewrite enabled. You need to disable pretty urls:

1. Open the '@app/config/web.php' file
2. Change the line:

`'enablePrettyUrl' => true,`

By

`'enablePrettyUrl' => false,`

## Revoke database config file permissions and delete the install file ¶

For security, even when the application is functioning properly, you must perform the following steps:

### 7.1 Revoke database config file permissions ¶

Through the File Transfer Program (FTP) or command line.

`chmod 0644 @app/config/db.php`

If the file's owner is the web server. Then, set the file permissions to 0444. For example, if you use an FTP client such as Filezilla:

    1. Open your FTP client
    2. Right-click on the 'config/db.php' file and click on 'File permissions...'
    3. Write 444 and Press ok

### 7.2 Delete the install file ¶

Through the File Transfer Program (FTP) or command line.

`rm @app/install.php`

## Add Cron Job to Server ¶

After the installation process is finished, the script will show exactly the command (red line) you should add to your server cron.

To configure the cron job with cPanel, perform the following steps:

    1. Go to your cPanel
    2. Click on Cron Jobs
    3. Go to Add New Cron Job section
    4. Select: Common Settings: Once Per Minute (* * * * *)
    5. Write in Command: /path/to/php /path/to/app/yii cron
    6. Press Add New Cron Job button

Don't forget to change the command in the step 5 by the red line after your installation. And that's it!

> Important! For performance reasons many actions or tasks are executed by the cron. E.g. sending notifications or statistics update.

> Note: If you have problems running the cron jobs, get in touch with our support team and we will be more than happy to help you.

## Configure access to your SMTP server ¶

Send emails using the PHP native function - mail() - suffer from many drawbacks in terms of Deliverability. Many anti spam filters end up blocking these emails. To avoid this problem, you must configure an SMTP account in the application to send all mail through it.

The SMTP server authentication data can be the one that comes with your hosting plan or by using an external service, such as Hotmail, Yahoo, Gmail or other.

As an example, consider how to configure the SMTP server with a Google Apps account or Gmail.

To configure your SMTP server:

1. In the navigation bar, click on your username and then click Settings
2. In the lower left block, click Mail Server
3. Please fill the fields with the following data:

       - Host: smtp.gmail.com
       - Port: 587
       - Encryption: TLS
       - Username: Your username on Google Apps or Gmail
       - Password: Your password on Google Apps or Gmail

4. Click Update

> Note: You can read more information in our Email Setup documentation.

## Configure the Site (Google reCAPTCHA and Google Maps) ¶

By configuring the Site you may:

- Renaming the application and Logo.
- Change the application description.
- Set the default mail application according with your domain.
- Set reCAPTCHA: For reCaptcha keys, go to Google reCAPTCHA website
  - ReCaptcha Secret Key
  - ReCaptcha Site Key

> Important! To use reCAPTCHA component in the form builder, you must first add reCAPTCHA keys in the site configuration. Otherwise, reCAPTCHA will not operate. If you created the form before adding the keys, you must update the form.

### 10.1 Add a Google Maps Api Key to the App ¶

1. []Get a key for Google Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/get-api-key)
2. Open the @app/config/params.php file.
3. Add the Google Maps JavasCript Api key to 'Google.Maps.apiKey'.
4. Save the file.

> Note: The Google Maps Api Key is required by the Submission Manager to show you the sender information.