RHEL / Oracle Linux + Apache

Installation guide

RHEL / Oracle Linux + Apache

Step-by-step deployment on RHEL 8/9, Oracle Linux, Rocky or AlmaLinux,
with Apache 2.4 and PHP-FPM 8.2, from the application package.

Requirements

Distribution RHEL / Oracle Linux 8.x or 9.x (Rocky, AlmaLinux compatible)
Web server Apache HTTPD 2.4 + PHP-FPM 8.2
Oracle Instant Client 19c — lightweight “Basic” package, 64-bit (RPM)
The application package sw_pkg_*.zip archive (see step 4)

1. Install Apache, PHP-FPM and the extensions

# Enable PHP 8.2 (RHEL 9 / OL 9)
sudo dnf module reset php
sudo dnf module enable php:8.2

# (RHEL 8: go through Remi)
# sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
# sudo dnf module enable php:remi-8.2

# Apache + PHP-FPM + required extensions
sudo dnf install -y httpd php-fpm php-cli php-common \
    php-mbstring php-gd php-ldap php-zip php-sodium php-process php-xml
sqlite3 is shipped by php-common. Do not install php-pdo: the application uses the native SQLite3 extension, not PDO.

2. Install the Oracle Instant Client and the OCI8 extension

# Instant Client 19c (Basic + Devel) — from the Oracle Linux repository
sudo dnf install -y oracle-instantclient-basic oracle-instantclient-devel
# (or install the RPMs downloaded from oracle.com)

# Declare the libraries to the linker
echo "/usr/lib/oracle/19.25/client64/lib" | \
    sudo tee /etc/ld.so.conf.d/oracle-instantclient.conf
sudo ldconfig

# Build the OCI8 extension via PECL
sudo dnf install -y php-devel php-pear gcc make
sudo pecl install oci8-3.3.0
# At the prompt, answer:
#   instantclient,/usr/lib/oracle/19.25/client64/lib

echo "extension=oci8.so" | sudo tee /etc/php.d/30-oci8.ini

3. Configure PHP-FPM

Edit /etc/php-fpm.d/www.conf (Apache user + Unix socket) and declare the Oracle environment there:

user = apache
group = apache
listen = /run/php-fpm/www.sock
listen.owner = apache
listen.group = apache

; Oracle environment (Instant Client)
env[LD_LIBRARY_PATH] = /usr/lib/oracle/19.25/client64/lib
env[ORACLE_HOME]     = /usr/lib/oracle/19.25/client64
env[TNS_ADMIN]       = /usr/lib/oracle/19.25/client64/network/admin

In /etc/php.ini: date.timezone, default_charset = "UTF-8", upload_max_filesize = 64M, post_max_size = 72M, memory_limit = 256M, display_errors = Off, log_errors = On.

4. Get and deploy the package

  1. Download the package from the Download page, choosing the archive for your network:
    • CDN: JS/CSS libraries loaded from the Internet (whoever browses the application needs Internet access);
    • Portable: libraries bundled into the archive (no Internet access required at runtime).
  2. Transfer then extract the archive on the server:
scp sw_pkg_*_portable.zip user@server:/tmp/
sudo mkdir -p /opt/app
sudo unzip /tmp/sw_pkg_*_portable.zip -d /opt/app

Resulting 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 (FastCGI to PHP-FPM)

Create /etc/httpd/conf.d/app.conf:

<VirtualHost *:80>
    ServerName mon-appli.example.com
    DocumentRoot /opt/app/mon-appli

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
    </FilesMatch>

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

    # Deny access to the non-web folders
    <DirectoryMatch "^/opt/app/(securite|log|lib|docs)">
        Require all denied
    </DirectoryMatch>

    ErrorLog  /var/log/httpd/app-error.log
    CustomLog /var/log/httpd/app-access.log combined
</VirtualHost>

AllowOverride All is required for the application’s .htaccess. Validate with sudo apachectl configtest.

6. Permissions and SELinux

# Owner: apache for the writable folders
sudo chown -R apache:apache /opt/app/securite /opt/app/log
sudo chmod 700 /opt/app/securite

# SELinux contexts
sudo semanage fcontext -a -t httpd_sys_content_t    "/opt/app/mon-appli(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/app/securite(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/opt/app/log(/.*)?"
sudo restorecon -Rv /opt/app

# Allow PHP to reach the network (LDAP, Oracle, OAuth)
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1

7. Start, open the firewall and check

sudo systemctl enable --now php-fpm httpd

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload

# 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.