Ubuntu / Debian + Apache

Installation guide

Ubuntu / Debian + Apache

Step-by-step deployment on Ubuntu 22.04/24.04 (or Debian) with Apache 2.4
and PHP 8.2, from the application package.

Requirements

Distribution Ubuntu 22.04 / 24.04 LTS (Debian 12 compatible)
Web server Apache 2.4 + PHP 8.2 module
Oracle Instant Client 19c — lightweight “Basic” package (.zip) + SDK, 64-bit
The application package sw_pkg_*.zip archive (see step 4)

1. Install Apache, PHP 8.2 and the extensions

sudo apt update
sudo apt install -y software-properties-common
# PHP 8.2 on Ubuntu (if not shipped by default)
sudo add-apt-repository -y ppa:ondrej/php
sudo apt update

sudo apt install -y apache2 libapache2-mod-php8.2 \
    php8.2 php8.2-cli php8.2-mbstring php8.2-gd php8.2-ldap \
    php8.2-zip php8.2-curl php8.2-xml php8.2-intl php8.2-sqlite3
php8.2-sqlite3 provides the native SQLite3 extension. sodium is built into PHP 8.2 core. Do not install any PDO package: the application does not use PDO.

2. Install the Oracle Instant Client and the OCI8 extension

From oracle.com, download the Instant Client Basic and SDK 19c ZIPs (Linux x64), then:

sudo apt install -y libaio1 unzip

sudo mkdir -p /opt/oracle
sudo unzip instantclient-basic-linux.x64-19.25*.zip -d /opt/oracle
sudo unzip instantclient-sdk-linux.x64-19.25*.zip   -d /opt/oracle
# -> /opt/oracle/instantclient_19_25

echo "/opt/oracle/instantclient_19_25" | \
    sudo tee /etc/ld.so.conf.d/oracle-instantclient.conf
sudo ldconfig

# Build OCI8 via PECL
sudo apt install -y php8.2-dev php-pear build-essential
sudo pecl install oci8-3.3.0
# At the prompt, answer:
#   instantclient,/opt/oracle/instantclient_19_25

echo "extension=oci8.so" | sudo tee /etc/php/8.2/mods-available/oci8.ini
sudo phpenmod oci8

3. PHP settings and Oracle environment

In /etc/php/8.2/apache2/php.ini: date.timezone, default_charset = "UTF-8", upload_max_filesize = 64M, post_max_size = 72M, memory_limit = 256M.

So that OCI8 finds the Oracle libraries under Apache, add to /etc/apache2/envvars:

export LD_LIBRARY_PATH=/opt/oracle/instantclient_19_25

4. Get and deploy the package

  1. Download the package from the Download page (CDN = libraries from the Internet; Portable = bundled libraries, no Internet).
  2. Transfer then extract the archive:
scp sw_pkg_*_portable.zip user@server:/tmp/
sudo mkdir -p /opt/app
sudo unzip /tmp/sw_pkg_*_portable.zip -d /opt/app

Layout: /opt/app/mon-appli (web root), /opt/app/lib, /opt/app/docs and a minimal securite/database.sqlite (no secret). The securite/master.key key and the full schema are created on first access. Default account: admin / admin123 (change it immediately).

5. Configure Apache

sudo a2enmod rewrite php8.2

# /etc/apache2/sites-available/app.conf
<VirtualHost *:80>
    ServerName mon-appli.example.com
    DocumentRoot /opt/app/mon-appli

    <Directory /opt/app/mon-appli>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex index.php
    </Directory>

    <DirectoryMatch "^/opt/app/(securite|log|lib|docs)">
        Require all denied
    </DirectoryMatch>

    ErrorLog  ${APACHE_LOG_DIR}/app-error.log
    CustomLog ${APACHE_LOG_DIR}/app-access.log combined
</VirtualHost>
sudo a2ensite app
sudo a2dissite 000-default
sudo apache2ctl configtest

6. Permissions

# Apache runs as www-data: write access to the writable folders
sudo chown -R www-data:www-data /opt/app/securite /opt/app/log
sudo chmod 700 /opt/app/securite

7. Start, open the firewall and check

sudo systemctl restart apache2
sudo ufw allow 'Apache'

# Check the extensions
php -m | grep -E 'oci8|sqlite3|mbstring|ldap|sodium'
php -r "echo oci_client_version().PHP_EOL;"

# HTTP test (expected: 302 to the login page)
curl -I http://localhost/
You are ready. The SQLite database and the encryption key are created on first access. Log in with the default account, change it, then configure your Oracle databases and authentication.