
If you have been managing a VPS or Dedicated Server running DirectAdmin for a while, you have probably wondered how to move PHP to a newer release, upgrade MariaDB, or refresh Apache without compiling everything from source by hand. In the DirectAdmin world the answer is a tool called CustomBuild — the heart of software management on the server. This article walks through CustomBuild 2.0 from the concept and directory layout to the essential commands, the options.conf settings that matter, and the precautions you should take before running a real build.
Read this first: CustomBuild must be executed with root privileges, so it is only available if you rent a VPS or Dedicated Server. Shared hosting customers cannot run these commands themselves. If you are on AsiaGB shared hosting and want to change your PHP version, use the selector in the DirectAdmin UI or open a support ticket — there is no need to touch CustomBuild at all.
What CustomBuild Is and What It Does in DirectAdmin
CustomBuild is the software build and update toolkit that ships with every DirectAdmin installation. It downloads source code, compiles, installs and updates the core software stack the web server depends on: the web server itself (Apache or Nginx), multiple PHP versions, the database engine (MySQL or MariaDB), the mail stack (Exim, Dovecot), phpMyAdmin, ClamAV and many other components. The version in standard use today is CustomBuild 2.0.
Its biggest strength is that everything is consolidated behind a single command, ./build. Instead of hunting for repositories or compiling each package manually, the administrator declares the desired stack in the options.conf file and runs a build. CustomBuild fetches the correct release, compiles it with settings that integrate cleanly with DirectAdmin, and rewrites the configuration files that wire the software to every user account on the machine. If you are coming from cPanel, the closest equivalent is EasyApache — but CustomBuild covers a broader scope, since it also manages the database and mail software rather than just Apache and PHP.
In one sentence: CustomBuild is the central installer and updater for the entire software stack of a DirectAdmin server — configure it once in options.conf, then drive everything with ./build.
Inside /usr/local/directadmin/custombuild
All CustomBuild files live in /usr/local/directadmin/custombuild, and every task starts by changing into this directory. The key components you will find inside are:
build— the main script; every operation is invoked as./build <command>.options.conf— the central configuration file that declares which web server, which PHP versions and modes, and which database engine the machine should run.custom/— the directory for your own modified configuration files, which protects them from being overwritten on rebuilds (critically important — covered in the precautions section below).- Source and cache directories — hold the downloaded tar.gz archives of PHP, Apache and other software used during compilation.
- Version data files — the list of the latest releases published by DirectAdmin, refreshed with
./build update.
cd /usr/local/directadmin/custombuild
ls -l
# build options.conf custom/ cache/ ...
The Essential Commands Every Admin Should Know
All commands are run as root from inside the custombuild directory. These are the ones you will use constantly:
cd /usr/local/directadmin/custombuild
./build update # refresh the CustomBuild script + latest version data
./build versions # show which components have newer releases available
./build php n # compile/update PHP according to options.conf
./build apache # update Apache
./build mysql # update MySQL/MariaDB per the configured engine
./build rewrite_confs # regenerate all web server configuration files
./build set <option> <value> # change an options.conf value safely
./build update— always run this first. It pulls the latest version metadata from DirectAdmin; without it,./build versionsreports stale information../build versions— prints a comparison of installed versus available versions for every component, which is how you decide what needs updating../build php n— recompiles PHP using the php*_release values in options.conf; the trailingntells the script to build without stopping to ask for confirmation along the way../build apache/./build mysql— update the web server and the database engine respectively../build rewrite_confs— regenerates the Apache/Nginx configuration of every domain on the box from templates; use it after changing PHP modes or whenever the configs are in a broken state.
Tip: compiling one PHP version takes roughly 10–30 minutes depending on the hardware. Always run big builds inside screen or tmux so a dropped SSH connection cannot kill the build midway.
Understanding options.conf: the Settings That Matter
The options.conf file is the brain of CustomBuild — every build reads its values from here. You can edit it directly with a text editor, or use ./build set, which is safer because the script validates the option names for you. The most important option groups are:
| Option | Example values | Meaning |
|---|---|---|
webserver | apache, nginx, nginx_apache, litespeed, openlitespeed | Selects the primary web server |
php1_release | 8.3 | The primary PHP version (slot 1) |
php2_release – php4_release | 8.2 / 8.1 / no | Additional PHP slots 2–4; set to no when unused |
php1_mode | php-fpm, mod_php, fastcgi, suphp, lsphp | Execution mode of each PHP slot |
mysql_inst | mariadb or mysql | Chooses the database engine family |
mariadb / mysql | 10.11 / 8.0 | Version of the selected database engine |
An example of switching the primary PHP slot to 8.3 with ./build set and rebuilding:
cd /usr/local/directadmin/custombuild
./build set php1_release 8.3
./build php n
./build rewrite_confs
Running Multiple PHP Versions Side by Side
The most common real-world scenario is a server hosting many sites: new projects want PHP 8.3 while a few legacy sites are stuck on an older release. CustomBuild 2.0 is designed for exactly this, supporting up to four PHP versions installed simultaneously through the php1_release to php4_release slots.
./build set php1_release 8.3
./build set php2_release 8.1
./build set php1_mode php-fpm
./build set php2_mode php-fpm
./build php n
./build rewrite_confs
Once the build finishes, each user can choose which PHP slot their own domain uses from Domain Setup → PHP Version Selector inside their DirectAdmin panel — no root involvement needed after that. This is exactly why customers on DirectAdmin hosting can switch PHP versions themselves from the web interface: the server administrator prepared the versions in advance with CustomBuild. See our guide How to Change PHP Version in DirectAdmin for the user-side steps.
MariaDB vs MySQL: Which Should You Pick?
CustomBuild lets you choose between two database engines via the mysql_inst option: MariaDB and MySQL. Both speak the same SQL dialect for everyday purposes and both run popular applications such as WordPress and Joomla without issues. The general guidance:
- MariaDB — the popular choice on DirectAdmin servers: fully open source, actively developed, strong performance, and a large community in the hosting world.
- MySQL — the right pick when your application or development team explicitly requires genuine MySQL, for example to use MySQL 8-specific features.
# Example: run MariaDB 10.11
./build set mysql_inst mariadb
./build set mariadb 10.11
./build mysql
The single biggest caution in this article: database upgrades are a one-way road. Downgrading a version or migrating across engines (e.g. MySQL → MariaDB) can leave data in an incompatible state. Before touching any of these options, mysqldump every database and store the dumps somewhere safe.
Precautions Before Every Build
CustomBuild is powerful — a single command affects every website on the machine. Build discipline pays off:
- Back up first, every time — at minimum dump all databases and copy the important configuration files. On a VPS, add a machine-level backup or snapshot as an extra layer. (AsiaGB hosting includes twice-monthly automated backups on the 1st and 15th, but on a self-managed VPS you must plan your own backup routine as well.)
- Expect a brief downtime window — the final stage of a build restarts services such as Apache or PHP-FPM, interrupting sites for a few seconds. Do it outside peak traffic hours.
- Manual config edits get overwritten —
./build rewrite_confsregenerates every config from templates, wiping direct edits to files likehttpd.conf. The correct method is to place your files in thecustombuild/custom/directory using DirectAdmin's documented structure so your versions are used instead of the stock templates on every build. - Verify PHP compatibility — before raising the primary PHP version, confirm that the themes and plugins of every site on the machine support it. When in doubt, install the new release as php2 first and migrate domains gradually.
- Read the output to the end — if a build fails, the error message tells you why. Do not blindly re-run the same command.
Using CustomBuild from the Web UI: the CustomBuild Plugin
If you prefer clicking to typing, DirectAdmin ships a CustomBuild plugin at the Admin level. Log in to DirectAdmin as admin and open Extra Features → CustomBuild. Its capabilities cover most routine work:
- View the full software list with version status (the equivalent of
./build versions) and trigger per-component updates from the browser. - Edit
options.confvalues through a form — pick PHP versions, PHP modes and the database engine without opening an editor. - Review past build logs to confirm whether a compile succeeded.
Under the hood, every button in the plugin calls the same ./build script you would run over SSH, so the understanding of commands and options.conf from the earlier sections still matters — especially when reading logs to troubleshoot a failed build.
Best Practices for Safe CustomBuild Usage
- Run
./build updatebefore starting any session so version data is current. - Check
./build versionsat least monthly; do not let components linger on old releases, especially PHP versions past end of life. - Run long builds inside
screen/tmux, and outside peak hours. - Keep every configuration customization inside
custom/— never edit generated files directly. - Change one thing at a time — do not update PHP, switch database engines and swap web servers in the same run; if something breaks, you will not know which change caused it.
- Smoke-test the key pages of your main sites (home page, login, checkout) immediately after each build.
- Keep a change log of what you changed, when, and from which version to which — it makes troubleshooting far easier later.
Frequently Asked Questions
Can I use CustomBuild on shared hosting?
No. CustomBuild must run as root on the server, so it is only available to VPS or Dedicated Server owners. On AsiaGB shared hosting, switch PHP versions through the PHP Version Selector in DirectAdmin, or open a support ticket at billing.in.th and the team will help.
What is the difference between ./build update and ./build versions?
./build update downloads the latest CustomBuild script and version data files from DirectAdmin's servers. ./build versions then compares each installed component against the newest available release so you can decide what to update. Run update first so the data is current.
Does rebuilding PHP take my websites down?
While PHP compiles, sites keep running on the existing binaries. There is only a brief interruption at the end when CustomBuild switches to the new binaries and restarts the web server — typically a few seconds. Schedule builds outside peak hours to be safe.
How many PHP versions can CustomBuild install at once?
Up to four, side by side, via the php1_release to php4_release options in options.conf. Each user then picks the version per domain from the Domain Setup / PHP Version Selector page.
My manual httpd.conf edits disappear after every build. What should I do?
Files generated by CustomBuild are overwritten whenever you run ./build rewrite_confs or rebuild the web server. Place your modified files inside custombuild/custom/ following DirectAdmin's structure — for example custom/ap2/conf/extra/ — and CustomBuild will use your custom files instead of the stock templates on every build.
Should I choose MariaDB or MySQL?
Both work equally well for common applications such as WordPress. MariaDB is the popular choice on DirectAdmin servers because it is fully open source and updates quickly; MySQL makes sense when your application specifically requires it. Remember that downgrading or switching engines is difficult — always dump all databases first.
Want the Full Power of CustomBuild? You Need Root Access
Rent an AsiaGB Linux VPS from 500 THB/month with full root privileges — install DirectAdmin and tune PHP, Apache and MariaDB exactly the way you want. SSD storage, 99% uptime, Thailand datacenter, 24/7 support team.
View VPS Plans