Documentation Launch
Deployment
Requirements, Apache, nginx, the PHP built-in server and a production checklist.
Requirements
- PHP 8.0 or newer;
- the
pdo_pgsqlorpdo_mysqlextension — if you need a database; - the
intlextension — for thedatemodule; - 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:
<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:
RewriteRule .*\.git/.* - [F]
RewriteRule ^(site|cache)/ - [F]If you keep static files inside site/, block only the subfolders that need it.
nginx + PHP-FPM
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:
<?php
if (is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) {
return false;
}
require __DIR__ . '/index.php';php -S localhost:8000 dev-router.phpPre-launch checklist
DEBUG = falseinconfig.php— visitors must not see stack traces.- The database is connected and the
site.logstable exists — otherwise errors become fatal (why). - The
cache/folder exists and is writable by the web server, if you use the cache, DB sessions or editable texts. - Direct access to
site/,cache/and.gitis blocked. - OPcache is enabled.
- 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:
cd olala && git pullThe index.php, config.php and .htaccess files and the site/ folder stay unchanged.