Skip to content
Eliel de Paula edited this page Sep 2, 2020 · 6 revisions

Installation

Here you will learn how to install Wpanel in different ways, the main ones being installation in a development environment and a production environment.

Summary

  1. Quick start (PHP + SQLite)
  2. Creating a development environment (Linux only)
    1. Clone the repository
    2. Install the dependencies
    3. Development server
    4. Database
    5. Run Wpanel the Setup
  3. Publishing in production
    1. Sending files to the server
    2. Production database
    3. Switch Wpanel to production mode
    4. Run Wpanel Setup in production

Quick Start

The easiest way to have Wpanel CMS ready to start developing your project is through Composer, with the SQLite database, using the built-in PHP server. To do this, follow the steps below.

  • Use composer to create your project:
composer create-project "wpanel/wpanel4-cms" Blog
  • Access the Blog folder created in the previous step and run the start script:
cd Blog
composer run dev

Development environment

Follow the steps below to set up your development environment. You can use the built-in PHP server or use a native server. You can also use Docker.

By default, Wpanel comes with the SQLite database configured, this can be changed without any difficulty. The specific steps for configuring the MySQL database will be described below.

Clone the repository

Run the command below to clone the Wpanel repository:

git clone https://github.com/wpanel/wpanel4-cms.git yourproject

Alternatively you can download the project in this link.

Install the dependencies

Wpanel uses the Composer dependency manager, if you have not installed it check here how to install it in your development environment.

Then, execute the command below so that everything is in place.

composer install

Development Server

You will need to have a local server with PHP 7 configured to run Wpanel. The simplest way to do this is using the server built into PHP 7, to do this just run the following command:

composer run dev

So the composer will run the embedded server pointing to the public folder.

Alternatively, you can run an Apache or NGINX server with PHP locally or another tool like XAMMP/LAMP and use several advanced features, such as Virtualhosts that will not be covered at this time.

Note: If you choose to use a native server or another solution, make sure the server is pointing to public/index.php

Database

*These steps are exclusive to MySQL, if you want to use SQLIte, proceed to the next step.

  • Create a database on your local MySQL using PHPMyAdmin for example or another tool of your choice.
  • Configure the database connection credentials in the file /public/config/config.php in the array $db['development'] as shown below:
$db['development'] = array(
    'dsn'	=> '',
    'hostname' => 'localhost',    // Hostname
    'username' => 'root',         // Username
    'password' => 'root',         // Password
    'database' => 'wpanel4-cms',  // DB Name
    'dbdriver' => 'mysqli',       // DB Driver
    'dbprefix' => '',
    'pconnect' => TRUE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

For more information on database connection settings read the CodeIgniter documentation here.

Run the Wpanel Setup

The setup process consists of creating the table structure in the database using migrations, and creating a ROOT user in the control panel. This user will have Developer privileges, which will be covered later in advanced topics.

Access the link http://localhost:8080/index.php/setup or the address you put on your local server, eg http://yourvirtualhost/index.php/setup

Setup

Fill out the form with the user's access credentials and click next.

After this process, you will be directed to the Site Administration login.

Login

Log in and welcome!

Admin

Click on the "View website" option on the top right bar to access the website.

Home

Publishing in production

Publishing your project in production is not much different from the previous steps, except that you need to pay attention to some details.

Sending files to the server

You can upload the project files to your production server via FTP or using GIT, if you have access to the server terminal. Check with your provider for availability.

We know that some shared hosting providers use a specific public folder in their configuration which can be public_html or www, in which case you will need to rename the public Wpanel folder for your situation.

In the end, the file structure should look like this:

/path/userfolder
  |- /app
  |- /sys
  |- /public_html   <--- Public folder
        |- index.php
        |- .htaccess

Note: Make sure that when accessing yourdomain.com the server is arriving at index.php

Production database

* These steps are exclusive to MySQL, if you want to use SQLIte, proceed to the next step.

  • Create a MySQL database on your server using PHPMyAdmin or another tool provided by your hosting.

  • Configure the database connection credentials in the /public/config/config.php file in the $db['production'] array as shown below:

$db['production'] = array(
    'dsn'	=> '',
    'hostname' => 'localhost',    // Hostname
    'username' => 'root',         // Username
    'password' => 'root',         // Password
    'database' => 'wpanel4-cms',  // DB Name
    'dbdriver' => 'mysqli',       // DB Driver
    'dbprefix' => '',
    'pconnect' => TRUE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

For more information on database connection settings read the CodeIgniter documentation here.

Switch Wpanel to production mode

By default, Wpanel is distributed in development mode, this activates some specific behaviors in the project, such as Profiler, error messages for debugging and other things. Activating Wpanel in production mode is important so that your project does not display certain information to the final user.

To enter production mode, change the ENVIRONMENT constant to 'production' in the /public/index.php file around line 76 as shown below.

From:

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

To:

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'production');

Run Wpanel Setup in production

The setup process follows the same principle as the process performed in the development environment.

Visit the link http://yoursite.com/index.php/setup

Setup

Fill out the form with the user's access credentials and click next.

After this process, you will be directed to the Site Administration login.

Login

Log in and welcome!

Admin

Click on the "View website" option on the top right bar to access the website.

Home

Note: Alternatively it is possible for you to restore a backup of your local database on the production server, dispensing with this step, however it is highly recommended that you maintain your database using Migrations for several factors, such as versioning and rollback possibility in case of errors.