Customizing Additional Service Config & Binary Paths in directadmin.conf


Verified User
May 8, 2005
Montreal, QC, Canada
Hi, I'm kindly requesting the ability to modify the binary names & paths of additional services and configuration files used by DirectAdmin, such as PHP, BIND (named) and a few others listed below. While DirectAdmin relies on directadmin.conf for the majority of its runtime configuration, I know it is also relying on custombuild's options.conf for a few additional services (namely PHP) to satisfy its own operational requirements.

According to the help page for all the directadmin.conf values, I am able to change the path of the Exim binary and where Apache stores its SSL certificates:

# Where exim lives for the mail spool query calls in Admin Level -> Mail Queue Admin

# The shared server certificate and key.  Used for the server IP and shared IPs https connections.
However, I have come across a situation where I need to tell DirectAdmin where to look for the following binaries/scripts and configuration file paths, but realized it was not possible through directadmin.conf (or it wasn't documented on the help page and no mention of it in ./directadmin c):

  • PHP FPM/CLI/CGI startup script and binary paths
  • PHP's php.ini path
  • PHP's php-fpm.conf path
  • PHP extensions, sockets, includes, etc, logs, libs and additional .ini directory paths
  • BIND (named) startup script path
  • Exim configuration (exim.conf) path
  • Exim SSL certificate(s) path(s)
  • Path to mysqldump
  • Apache startup script path
  • Apache user & group to run under
  • Appropriate newsyslog.conf path foir DA to modify

Reason for this request (the "why?")

The goal is to standardize the way DirectAdmin talks to FreeBSD, without having to resort to modifying configuration files or symlinking scripts & binaries across the entire system.

I'm currently writing a script called PortsBuild to configure and setup a FreeBSD system with all service binaries installed from Ports. I'm actually running a production system right now with my documented methods with very little issues. I have come across a situation where certain services, such as PHP-FPM, Apache 2.4 and BIND (named) are not restarting after changes are done because DirectAdmin is looking for these binaries in the wrong places (or it doesn't know the correct name of the scripts). Furthermore, certain configuration files and directories are located elsewhere on a FreeBSD system (normally a symlink fixes this issue) however DA/CB2 is hardcoded to actively disregard (and even overwrite) certain files and paths. Some concrete examples of the problems I am facing are listed below.

1. Trouble restarting services (control & startup scripts)

On my 9.3 system, PHP-FPM's startup and daemon control script is /usr/local/etc/rc.d/php-fpm, however DirectAdmin is expecting the binary to be php-fpmXX (e.g. XX=55 for 5.5, 56 for 5.6, etc.) instead. After adding a new user, PHP-FPM will not restart, thus requiring a manual reload through the terminal for the configuration files to reload. From errortaskq.log:

2015:12:07-00:31:01: Error gracefuling service php-fpm56 : uid 0 gid 0 : /usr/local/etc/rc.d/php-fpm56 graceful        >/dev/null 2>/dev/null                      : returned 127
Likewise, installing Apache 2.4 from /usr/ports/www/apache24 comes with a startup control script called "apache24", yet DirectAdmin is hardcoded to look for httpd in /usr/local/etc/rc.d/ and thus also requires a manual reload through the terminal. Also, not being able to use the Ports version of the script limits FreeBSD users from not being able to run Apache with the accf_http kernel (apache24_http_accept_enable="YES") for additional performance benefits.

Similarly, the issue seems to be also present with BIND 9.9.5 when using the base system's startup file (found at /etc/rc.d/named) yet DirectAdmin expects its own version at /usr/local/etc/rc.d/named (which is not a problem if running BIND on 10.x!). Symlinking won't work in this case because I won't be able to use /etc/rc.conf as the daemon will be started twice and as a result, a sysadmin won't be able to control services via the console (e.g. "service apache24 restart"). I noticed I can change the path to named.conf (namedconfig=) and the working directory (nameddir) in directadmin.conf, but not the binary. :)

2. PHP Directories used by DirectAdmin and CustomBuild2

I will simply explain the issue by showing a few of the commands used by PortsBuild to have DA/CB2 play with PHP-FPM from Ports. :)

# Symlink (replace php56 with appropriate version as necessary)
ln -s /usr/local/bin/php /usr/local/php56/bin/php
ln -s /usr/local/bin/php-cgi /usr/local/php56/bin/php-cgi
ln -s /usr/local/bin/php-config /usr/local/php56/bin/php-config
ln -s /usr/local/bin/phpize /usr/local/php56/bin/phpize
ln -s /usr/local/sbin/php-fpm /usr/local/php56/sbin/php-fpm 
ln -s /var/log/php-fpm.log /usr/local/php56/var/log/php-fpm.log
ln -s /usr/local/include/php /usr/local/php56/include

# Scan directory for PHP ini files:
ln -s /usr/local/etc/php /usr/local/php56/lib/php.conf.d
ln -s /usr/local/etc/php.ini /usr/local/php56/lib/php.ini
ln -s /usr/local/etc/php-fpm.conf /usr/local/php56/etc/php-fpm.conf
ln -s /usr/local/lib/php/build /usr/local/php56/lib/php/build
ln -s /usr/local/lib/php/20131226 /usr/local/php56/lib/php/extensions
If possible, I'd like to be able to set these paths in directadmin.conf and avoid having to create so many symlinks.

3. CustomBuild Dependency

I had written a much longer explanation/request for this case, then I realized I may be totally wrong with my assumption. Instead, I will ask a question: besides options.conf, what else does DirectAdmin rely on CustomBuild for? (apart from the first-timeinstallation process, re: scripts)

Regarding options.conf, which settings in particular is DA interested in?

4. Unnecessary overriding of /etc/*.conf files (or "how to do it the FreeBSD way")

On FreeBSD, base system-level configuration files are stored in /etc/ (rc.conf, sysctl.conf, etc.). Third-party application configs (user & system) are normally stored in /usr/local/etc/. FreeBSD sysadmins are encouraged (if not recommended) to customize configuration files by overriding the necessary switches/flags in separate files. This allows a much easier and smoother OS upgrade process to take place as base configuration files don't require manual intervention or merging.

For example, DirectAdmin does not have to modify /etc/newsyslog.conf to add its own list of files to monitor & rotate. At the bottom of /etc/newsyslog.conf, the user is presented with two include paths for the newsyslog daemon to watch:

<include> /etc/newsyslog.conf.d/*
<include> /usr/local/etc/newsyslog.conf.d/*
Simply put, I have created /usr/local/etc/newsyslog.conf.d/directadmin.conf for DirectAdmin to utilize, but it doesn't seem to like it. It keeps re-adding the entries in /etc/newsyslog.conf after certain functions are executed (I forgot which...). I know I can modify scripts/, but I am trying to stay away from modifying DA files as much as possible unless I can override it in say a custom/ directory (something I haven't tried with, actually).

Finally, this issue extends with /etc/exim.conf (default: /usr/local/etc/exim/configure), location of /etc/ and /etc/system_filter.exim, and /etc/dovecot/dovecot.conf (default: /usr/local/etc/dovecot/dovecot.conf) among others.

5. Cannot use services.status

One of my favourite features that comes with DirectAdmin are the alerts I get when a service goes down. Unfortunately, I cannot use it for PHP-FPM and Apache, as the start scripts are named differently (pun intended!). If I can somehow tell DirectAdmin that Apache is actually "apache24" and not "httpd" (and where it can find the files) then I'll be a happy clam.

6. Miscellaneous

DirectAdmin insists on using the "apache" user & group (goes so far to creating the account for me!) but FreeBSD naturally comes with the user & group "www" already sandboxed. I know, this doesn't sound like a big deal to many, but it essentially breaks www/apache24 and requires modifying httpd.conf to reflect apache/apache or else the web server won't work with DirectAdmin. Same goes for Exim's usage of "mail:mail".

Thank you for taking the time to read this. :D

TLDR: I'd like to override Apache, PHP, Bind, Named, etc. config files, scripts & binary paths in directadmin.conf.


Verified User
Dec 4, 2006
Can I bump this thread and add my vote for getting this done?

I am also a happy freebsd user and therefore very interested in this.