Installation

One installation is one site. These steps install Energine Simple into an empty database; Your first site goes on from there. The interface comes in English, Russian and Ukrainian.

Requirements

  • PHP 8.4 or newer with the extensions ctype, dom, fileinfo, gd, json, libxml, mbstring, openssl, PDO, pdo_mysql, session, SimpleXML and xsl. GD needs JPEG, PNG and WebP support for the image resizer. Optional: tidy, which cleans the HTML of texts before they are saved; posix, which lets the installer ask for passwords — without it the passwords come only from environment variables.
  • MariaDB — an empty database and its user. The user needs the right to create routines (CREATE ROUTINE and ALTER ROUTINE): the schema has a stored function and procedures, and the installer checks this before it changes anything.
  • Composer — only to generate the autoloader; Simple has no third-party PHP packages.
  • A web server that passes PHP files to PHP and sends unknown addresses to index.php — see Web server. The repository ships no web-server configuration.
  • Shell access as the user that owns the site, not root. The installer, setup demo, setup page and setup linker refuse to run as root: files that belong to root may not be served.

Layout

The web server's document root is web/, and the repository lives next to it in private/energine. The code looks for itself at ../private/energine from the document root, so keep these names:

my-site/
├── web/                         document root
│   ├── index.php  bootstrap.php  auth.php  resizer/    copied from htdocs/
│   ├── uploads/                 the site's files
│   ├── system.config.php        link to the site's configuration
│   └── images/  scripts/  stylesheets/  templates/     links made by setup linker
└── private/energine/            the repository
    ├── core/      the modules share, user and seo
    ├── site/      your site: theme, XSLT, page templates, translations
    ├── setup/     the console tool
    ├── sql/       schema, base data, demo content, database migrations (sql/cut/)
    ├── htdocs/    the files to copy into web/
    ├── configs/   the configuration template and the site's configuration
    └── docs/  tests/  tools/

site/ is in the same git tree as the core: your theme and templates are part of the repository you cloned.

1. Get the code

cd my-site
git clone --branch simple https://github.com/kwebmn/energine-cmf-latest.git private/energine
git -C private/energine config core.hooksPath .githooks

The hook refuses a commit that contains the database password or the test administrator's password.

2. Copy the entry files into the document root

mkdir -p web
cp private/energine/htdocs/index.php private/energine/htdocs/bootstrap.php private/energine/htdocs/auth.php web/
cp -a private/energine/htdocs/resizer private/energine/htdocs/uploads web/

On most hosting the document root already exists; mkdir -p web creates it otherwise. auth.php takes the sign-in and sign-out forms; resizer/ serves resized pictures.

3. Generate the autoloader

cd private/energine
composer install --no-dev
cd ../..

Without it the site stops with Autoloader not found. Firstly you have to run "composer install".

4. Run the installer

From the document root, as the site's user:

cd web
php index.php setup install --domain=example.com --db-name=site --db-user=site --admin-email[email protected]

Passwords are never options: the installer reads them from ENERGINE_DB_PASSWORD and ENERGINE_ADMIN_PASSWORD, or asks for them without echo. An option that looks like a password is refused.

Option Meaning
--admin-email Required. The administrator's e-mail, which is also the login; at most 50 characters.
--admin-name The administrator's name; Admin by default.
--domain The site's host, with :port if the port is not standard.
--url Instead of --domain: the full address, http(s)://host[:port]/path/; the path becomes the site's root.
--db-host, --db-port, --db-socket Where MariaDB is: localhost and 3306 by default; a socket replaces host and port.
--db-name, --db-user The database and its user.
--config Read or write the configuration at this file instead of configs/system.config.<host>.php; no link is made in web/.
--no-static Skip the last step, setup linker.

The installer:

  1. checks the PHP extensions and refuses to run as root;
  2. checks that the database is empty — no tables and no routines — and that its user may create routines;
  3. writes the site's configuration, configs/system.config.<host>.php, from the template, readable by its owner only and with debug mode off, and links it from web/system.config.php;
  4. loads the schema, the base data and the site's translations, and creates the administrator in the group «Администратор» (Administrator);
  5. runs setup linker, which links the theme, scripts and templates into web/;
  6. prints Готово: (Done) and the site's address.

If it fails, it prints the reason and exits with code 1. A configuration written by that run is removed, but the database stays partly filled: empty it — tables and routines — before you try again. If only the last step failed, the site is installed: fix the cause and run php index.php setup linker.

When the configuration already exists, run the installer with --admin-email only: it takes the database and the address from the configuration and refuses database options or a different address.

Web server

Unknown addresses go to index.php, and the addresses of resized pictures to the resizer. The repository documents these two rules for nginx:

location / {
    try_files $uri $uri/ @rewrites;
}

location @rewrites {
    rewrite ^ /index.php last;
}

rewrite "^/resizer/w([0-9]+)\-h([0-9]+)/(.*)$" /resizer/timthumb.php?w=$1&h=$2&src=$3&zc=2;

Pass .php files to PHP-FPM as usual, and keep private/ outside the document root. The files in web/images, web/scripts, web/stylesheets and web/templates are links into the repository: with nginx's disable_symlinks if_not_owner they must belong to the site's user. Do not put a static robots.txt into web/ — it would replace the site's own. Security headers and the redirect to HTTPS are the web server's job; see Security.

Demo content

Right after setup install, php index.php setup demo loads demo content: pages — among them a «Лендинг» (Landing) home page, a «Возможности» (Features) section with subpages, a «Услуга» (Service) and a «Контакты» (Contacts) page — three demo visitors and a picture. It is meant for trying Simple out, not for a client's site: it is accepted only on a fresh install, there is no command to remove it, and setup check reports the demo users as a failure.

After installing

  • Sign in at /login/ with the administrator's e-mail and password; the admin is under /admin/.
  • Before you hand the site over, run php index.php setup check. It lists what is not ready — debug mode, the address, demo users, broken links, untranslated strings, mail settings — and exits with code 1 on a failure. See Your first site.
  • To update the site later, see Updating.