DirectAdmin CustomBuild updating Apache PHP MySQL on a server

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:

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

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:

OptionExample valuesMeaning
webserverapache, nginx, nginx_apache, litespeed, openlitespeedSelects the primary web server
php1_release8.3The primary PHP version (slot 1)
php2_releasephp4_release8.2 / 8.1 / noAdditional PHP slots 2–4; set to no when unused
php1_modephp-fpm, mod_php, fastcgi, suphp, lsphpExecution mode of each PHP slot
mysql_instmariadb or mysqlChooses the database engine family
mariadb / mysql10.11 / 8.0Version 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:

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

  1. 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.)
  2. 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.
  3. Manual config edits get overwritten./build rewrite_confs regenerates every config from templates, wiping direct edits to files like httpd.conf. The correct method is to place your files in the custombuild/custom/ directory using DirectAdmin's documented structure so your versions are used instead of the stock templates on every build.
  4. 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.
  5. 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:

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

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