RU EN
Get started

Documentation Launch

Deployment

Requirements, Apache, nginx, the PHP built-in server and a production checklist.

Requirements

  • PHP 8.0 or newer;
  • the pdo_pgsql or pdo_mysql extension — if you need a database;
  • the intl extension — for the date module;
  • OPcache — optional, but it noticeably speeds up any PHP site, and olala templates are PHP.

The document root must be the folder containing index.php and olala/. All framework paths are resolved relative to it.

Apache

Everything is ready: the .htaccess in the root sends every request except existing files to index.php. You need the mod_rewrite module and permission to use .htaccess:

/etc/apache2/sites-available/olala.glenn.ru.conf
<VirtualHost *:80>
    ServerName olala.glenn.ru
    DocumentRoot /var/www/olala.glenn.ru

    <Directory /var/www/olala.glenn.ru>
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

We recommend adding rules to .htaccess that block direct access to the code and the cache:

.htaccess
RewriteRule .*\.git/.* - [F]
RewriteRule ^(site|cache)/ - [F]

If you keep static files inside site/, block only the subfolders that need it.

nginx + PHP-FPM

/etc/nginx/sites-available/olala.glenn.ru
server {
    listen 80;
    server_name olala.glenn.ru;
    root /var/www/olala.glenn.ru;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ ^/(site|cache)/ { deny all; }
    location ~ /\.git          { deny all; }

    location = /index.php {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
    }

    location ~ \.php$ { deny all; }   # don't execute any other .php directly

    location ~* \.(css|js|svg|png|jpe?g|webp|woff2?)$ {
        expires 30d;
        access_log off;
    }
}

The olala router reads the URL from REQUEST_URI, so no extra FastCGI parameters are needed.

The PHP built-in server

You don't need a web server for development. The built-in server just needs a tiny router so that static files are served as is:

dev-router.php
<?php
if (is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
    return false;
}

require __DIR__ . '/index.php';
Terminal
php -S localhost:8000 dev-router.php

Pre-launch checklist

  1. DEBUG = false in config.php — visitors must not see stack traces.
  2. The database is connected and the site.logs table exists — otherwise errors become fatal (why).
  3. The cache/ folder exists and is writable by the web server, if you use the cache, DB sessions or editable texts.
  4. Direct access to site/, cache/ and .git is blocked.
  5. OPcache is enabled.
  6. HTTPS is set up (for example, with Let's Encrypt).

Updating the framework

Site code and the framework are separated, so updating means replacing the olala/ folder:

Terminal
cd olala && git pull

The index.php, config.php and .htaccess files and the site/ folder stay unchanged.