Version 1.0.0 · Works on cPanel, DirectAdmin, Plesk, Ubuntu VPS and AlmaLinux · Apache or Nginx
| Item | Requirement |
|---|---|
| PHP | 8.2 or newer |
| PHP extensions | pdo, pdo_mysql, json, openssl, curl, fileinfo, mbstring, tokenizer, xml, zip, session |
| Database | MySQL 8.0+ (MariaDB 10.4+ also works) |
| Web server | Apache 2.4 (mod_rewrite) or Nginx |
| HTTPS | Strongly recommended — required for production logins |
| Writable folders | storage/ (and sub-folders) and
config/ |
The wizard checks all of this for you in step 2.
affiliate.example.com) and extract
it.https://affiliate.example.com/install./install now shows
Application Already Installed.Do the install right after uploading. Until installation finishes, anyone who can reach
/installcould run the wizard.
Recommended (most secure): set the subdomain
document root to the public/ folder. Then
app/, config/, database/,
storage/, install/ and cron/ are
not inside the web root at all.
.../affiliate.example.com/public). If the
extracted files are inside a folder, include it..../public.public_html symlink method).Also supported: keep the document root at the
extracted folder. The supplied root .htaccess blocks every
private folder and routes requests to public/. This
requires Apache with AllowOverride enabled (default on
cPanel, DirectAdmin and Plesk). The installer’s Private files
protected check confirms it works.
cPanel: MySQL® Database Wizard → create
database → create user with a strong password → tick ALL
PRIVILEGES. Note that names are prefixed
(account_dbname, account_dbuser).
DirectAdmin: MySQL Management → Create new Database, enter name, user and password.
Plesk: Databases → Add Database, then create a database user with full access to it.
Ubuntu / AlmaLinux (command line):
CREATE DATABASE affiliate CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'affiliate'@'localhost' IDENTIFIED BY 'CHOOSE_A_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON affiliate.* TO 'affiliate'@'localhost';
FLUSH PRIVILEGES;Use host localhost, port 3306, and keep the
default prefix aff_ in the wizard.
| Path | Permission |
|---|---|
| folders | 755 (or 775 if your host requires group
write) |
| files | 644 |
storage/ and sub-folders |
writable by the PHP user (755/775) |
config/ |
writable during install; config/config.php is written
as 640 |
cd /var/www/affiliate
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chown -R www-data:www-data storage config # Ubuntu; use apache:apache on AlmaLinuxOn cPanel/DirectAdmin/Plesk PHP already runs as your account user, so
no chown is needed.
After installation you may tighten config/ to read-only:
chmod 555 config.
Nothing to do: .htaccess files are included (root,
public/, and a deny-all in every private folder). Make sure
mod_rewrite is enabled and AllowOverride All
is set for the site on a VPS:
<VirtualHost *:443>
ServerName affiliate.example.com
DocumentRoot /var/www/affiliate/public
<Directory /var/www/affiliate/public>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>Use docs/nginx.conf.example (document root =
public/, PHP-FPM, deny rules, security headers). After
editing, run
nginx -t && systemctl reload nginx.
Nginx ignores .htaccess, so do not use
the project root as the document root on Nginx.
sudo apt install certbot python3-certbot-nginx && sudo certbot --nginx -d affiliate.example.comsudo apt install certbot python3-certbot-apache && sudo certbot --apache -d affiliate.example.comsudo dnf install certbot python3-certbot-nginx (or
-apache), then the same certbot command.The portal needs one job, every 5 minutes, running
cron/run.php. The wizard (step 8) shows the exact command
for your server. The format is:
*/5 * * * * /usr/bin/php /path/to/affiliate/cron/run.php >/dev/null 2>&1
/usr/local/bin/ea-php82 (see MultiPHP
Manager).crontab -e as the user that owns
the files, paste the line, save.Cron is reported as running only after the script has really executed: each run records a heartbeat, and the installer’s Check cron status button and the admin dashboard read it. Until then they show Not verified.
In WHMCS: Setup → Staff Management → Manage API Credentials →
Generate New API Credential. Create an API Role
allowing at least: GetClients,
GetClientsProducts, GetClientsDomains,
GetInvoices, GetProducts.
If WHMCS uses API IP Access Restriction (Setup → General Settings → Security), add the public IP of the affiliate portal server. The wizard’s test reports the exact IP WHMCS rejected. Alternatively use an API Access Key.
The WHMCS URL must be the public address of WHMCS (private/internal
addresses are refused for safety; set the environment variable
AFFILIATE_ALLOW_PRIVATE_URLS=1 if WHMCS is genuinely on a
private network).
The API secret is stored encrypted (AES-256-GCM) in the database; the
key lives only in config/config.php.
You can skip this step and configure everything later at
https://affiliate.example.com/admin/whmcs.
/admin/login.storage/installer.lock exists,
config/config.php holds your configuration.install/ folder (not
required — it is locked and unreachable).config/config.php (it contains your application
key; without it the stored WHMCS secret cannot be decrypted).storage/logs/installer.log (installer),
storage/logs/cron.log, storage/logs/app.log.
Secrets are redacted before being written. These folders are blocked
from web access.
| Message | Fix |
|---|---|
| Unsupported PHP version | Switch to PHP 8.2+ in the hosting panel |
| Missing extension | Enable it (cPanel Select PHP Version → Extensions; Ubuntu
apt install php8.2-<ext>) |
| Not writable | Fix permissions (section 5) |
| Invalid database credentials | Use the prefixed username shown in your panel; re-enter the password |
| Database not found | Create the database first |
| Insufficient privileges | Grant ALL PRIVILEGES to the user on that database |
| Existing installation detected | The database already contains a finished install. Use an empty database or another prefix |
| SQL migration failed | Read storage/logs/installer.log, fix the cause, press
Retry — finished migrations are skipped, nothing is
duplicated |
| Configuration could not be written | Make config/ writable and retry |
| WHMCS: Invalid IP | Whitelist the portal server IP in WHMCS |
| WHMCS: Authentication failed | Check Identifier/Secret; make sure the credential is enabled |
storage/ publicly readable warning |
Point the document root to public/, or add the Nginx
deny rules |
404 on /install (Apache) |
mod_rewrite / AllowOverride is
disabled |
There is no web option to reinstall. Over SSH, as the account that owns the files:
mysqldump -u USER -p DATABASE > backup.sql # always back up first
php bin/reinstall.phpThe tool requires typing YES and then
REINSTALL <database name>. It drops every table with
the configured prefix, backs up and removes
config/config.php, and removes the lock so
/install works again.
public/ web root (front controller, assets, help)
install/ installer (private; reached only through /install)
app/ application code
config/ config.example.php (+ generated config.php)
database/ migrations/ and seeds/
storage/ installer.lock, logs/, sessions/, cache/, uploads/, backups/
cron/ run.php
bin/ reinstall.php
docs/ this manual, nginx.conf.example