VLAM Documentation

Configure Dedicated Server

A few things need to be set-up and configured.

Some composer modules might have changed been updated, so we want to verify a few things.

Hosting environment requires PHP>8.2 and ext-intl extension enabled.

Adjust the .env configuration

  1. Uncomment and point app.baseURL in .env to the root url of your server. eg: http://vlam.your-domain.com/
    app.baseURL = ''
  2. Ensure database connection variables uncommented and correctly set in .env
    database.default.hostname = localhost <- Set this
    database.default.database = vlam_db
    database.default.username = vlam_user
    database.default.password = vlam_pass
    database.default.DBDriver = MySQLi
    database.default.DBPrefix =
    database.default.port = 3306

When not using the .env file:

  1. Set variable $baseURL in app/Config/App.php to the root url of your server. eg: http://vlam.your-domain.com/
    /**
    * --------------------------------------------------------------------------
    * Base Site URL
    * --------------------------------------------------------------------------
    *
    * URL to your CodeIgniter root. Typically, this will be your base URL,
    * WITH a trailing slash:
    *
    * E.g., http://example.com/
    */
    public string $baseURL = 'http://vlam.your-domain.com/';
  2. Ensure database connection variables are correctly set in app/Config/Database.php
    /**
    * The default database connection.
    *
    * @var array<string, mixed>
    */
    public array $default = [
        'DSN'          => '',
        'hostname'     => 'localhost',
        'username'     => 'your-username',
        'password'     => 'your-password',
        'database'     => 'your-database-name',
        'DBDriver'     => 'MySQLi',

Setup Database

By default the sql/vlam.sql is imported. use phpmyadmin to import a local backup. Migrations are not supported for this project yet ..

Verify

  1. The Login controller is a clone of Shield's, this prevents the custom login page from being overwritten.
    Ensure Controllers\LoginController::loginView() matches CodeIgniter\Shield\Controllers\LoginController::loginView() .

Configure Apache server

If you run a fresh apache webserver, you might want to set up the following.

  1. Give valid permissions to writable folder and subfolders
    # This will add permissions, use valid user, commonly www-data for apache2 servers
    sudo chown -R www-data writable
  2. Enable modrewrite
    # Check if modrewrite is enabled:
    apache2ctl -M | grep rewrite
    
    # when nothing returns, enable using:
    sudo a2enmod rewrite
    sudo systemctl restart apache2
  3. Create Virtual Host
    # When you don't have this set up already, add a vhost.
    # sudo nano /etc/apache2/sites-available/vlam.your-domain.com.conf
    <VirtualHost *:80>
        ServerName vlam.your-domain.com
    
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/vlam/public
    
        <Directory /var/www/html/vlam/public>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    
        ErrorLog ${APACHE_LOG_DIR}/vlam_error.log
        CustomLog ${APACHE_LOG_DIR}/vlam_access.log combined
    </VirtualHost>
    
    # save & exit
    sudo a2ensite vlam.your-domain.com.conf
    sudo systemctl reload apache2
    
    # disable default vhost:
    sudo a2dissite 000-default.conf
    sudo systemctl reload apache2
  4. TIP: Temporary enable error printing:
    nano app/Config/Boot/production.php
    # Change:
    ini_set('display_errors', '0');
    # To:
    ini_set('display_errors', '1');
  5. ERROR: Call to a member function getErrors() on null
    # If you encounter a php error during login, likely reason is a glitch with shield.
    # Try the following commands in the root of the project using the cli:
    
    composer require codeigniter4/shield:^1.1
    composer update

Done

You should now be able to see a correctly setup instance when you navigate to: http://vlam.your-domain.com/

Search results