1. What is custombuild?
Custombuild is a tool, which can install/update:
  • Apache
  • AWstats
  • Autoconf
  • Automake
  • ClamAV
  • cURL
  • Dovecot
  • Exim configuration files
  • FreeType
  • GD
  • ionCube loaders
  • libiconv
  • libjpeg
  • libpng
  • libmcrypt
  • libmhash
  • mod_perl
  • mod_ruid2
  • MySQL
  • PHP (mod_php, PHP-FPM, suPHP)
  • ProFTPD
  • Pure-FTPd
  • SpamAssassin
  • Webalizer
  • Zend Optimizer
  • Zlib
Update web-applications:
  • Roundcube webmail
  • Squirrelmail webmail
  • phpMyAdmin

What is new in CB 2.0? The main changes:
Code:
  • Using PHP 5.4 as mod_php + mod_ruid2 by default (except FreeBSD systems where PHP 5.4 is installed in suPHP mode without mod_ruid2)
  • Dropped PHP 4.4, 5.2 support
  • Dropped Apache 1.3, 2.0, 2.2 support
  • Dropped MySQL 4.1 support
  • Dropped UebiMiau and Atmail Open webmail support.
  • Ability to install PHP 5.3 + 5.4 together
  • Automatic exim.conf changes after installation/update of ClamAV/SpamAssassin (it uses includes of /etc/exim.spamassassin.conf and /etc/exim.clamav.conf in /etc/exim.conf)
  • Major change: PHP-FPM support was added, new paths to PHP binaries/configs (/usr/local/php53(54))
  • Major change: mod_ruid2 support was added (you can use it together with suPHP)
  • Major change: event MPM is now used instead of the prefork one, if PHP-FPM is running
  • Major change: new way of PHP exension installations (using php.conf.d, not the main php.ini), ability to include many new extensions to the future versions of CB
  • Major change: mysqlnd (MySQL native driver) is used for MySQL, pdo-MySQL and MySQLi in php configuration.
  • Added --with-xsl, --enable-soap to PHP configuration files
  • php1_mode/php2_mode + php1_release/php2_release options.conf settings. php1_release is the main version of PHP, php2 is the additional one.
  • Major change: if php1/php2_mode is set to suphp or php-fpm, event Apache MPM is used (when no mod_php is selected).
  • Major change: pureftpd is now the default FTP service. New option: ftpd=pureftpd/proftpd. (replaced old pureftpd=yes/no, proftpd=yes/no)













2. How to upgrade custombuild to 2.0?
The best way to do that is a complete reinstallation of CustomBuild, because of changes in configuration files, options.conf etc. Please note that you need DirectAdmin version 1.42.0 at least (you can use current pre-release binaries too) to run CustomBuild 2.0.
Code:
cd /usr/local/directadmin
mv custombuild custombuild_1.x
wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
./build
Please check your options.conf file, set the settings you would like to have. The following steps are needed after upgrade of the CustomBuild script:
Code:
./build apache
./build php n
./build rewrite_confs
However, if you want to rebuild everything:
Code:
./build all d
3. How to install custombuild 2.0?
Code:
cd /usr/local/directadmin
wget -O custombuild.tar.gz http://files.directadmin.com/services/custombuild/2.0/custombuild.tar.gz
tar xvzf custombuild.tar.gz
cd custombuild
./build
You need to run this command for the first time:
Code:
./build all d
4. How do php1_release/mode and php2_release/mode work in the options.conf file?
Main requirements:
  • Do not set both php1_release and php2_release to the same release of PHP.
  • Do not set both php1_mode and php2_mode to mod_php, if php2_release is set.

php1_release is always the default version of PHP which is be used for virtualhosts, php2_release is the additional one which needs to be chosen in .htaccess or apache configuration files. Available options for php1/php2_mode are:
  • mod_php - PHP is installed as apache loaded module (mod_php) this way, together with this option mod_ruid2=yes can be set to run apache processes under specified user names.
  • php-fpm - PHP is installed as PHP-FPM this way, mod_fastcgi is used in apache configuration for connections to PHP-FPM sockets that are placed in /usr/local/php53/sockets or /usr/local/php54/sockets.
  • suphp - PHP is installed as CGI this way, suphp module is used in apache configuration. suPHP configuration file can be found here: /usr/local/suphp/etc/suphp.conf
5. How to see what's set in the options.conf file?
Use "./build options" to see what's set in the options.conf file. The output will be something like:
Apache: 2.4.3
Dovecot: 2.1.10
MySQL: 5.5.27
PHP (default): 5.4.7 as mod_php
Run "clean" every time: yes
6. What each option does in options.conf?

PHP options:
  • php1_release - select the default PHP release which you would like to get installed/updated using "./build php" or "./build all". Possible values: 5.3/5.4 (default: 5.4).
  • php2_release - select the additional PHP release which you would like to get installed/updated using "./build php" or "./build all". Possible values: 5.3/5.4/no (default: no).
  • php1_mode - select the PHP run-mode of php1_release. Possible values: mod_php/suphp/php-fpm (default: mod_php (on FreeBSD: suphp)).
  • php2_mode - select the PHP run-mode of php2_release. Possible values: mod_php/suphp/php-fpm (default: php-fpm).
  • php_ini - update PHP configuration file using "./build php-ini" or "./build all". Possible values: yes/no (default: no).
  • php_ini_type - this option is used to set what type of php.ini file CustomBuild needs to use while executing "./build php-ini". Possible values: production/development (default: production).
  • ioncube - install/update ionCube using "./build ioncube" or "./build all". Possible values: yes/no (default: no).
  • zend - install/update Zend Optimizer using "./build zend" or "./build all". Possible values: yes/no (default: no).
  • mod_ruid2- install/update mod_ruid2 using "./build mod_ruid2" or "./build all". Possible values: yes/no (default: yes (on FreeBSD: no)). It gets installed automatically if mod_ruid2 value is "yes" and php1/php2_mode is set to "yes".

MySQL options:
  • mysql - this option is used to choose the version of MySQL. Possible values: 5.1, 5.5 (default: 5.5).
  • mysql_inst - install/update MySQL using "./build mysql" or "./build all". Possible values: yes/no (default: no).
  • mysql_backup - backup MySQL every time with MySQL update. Possible values: yes/no (default: yes).

Apache options:
  • apache_ver - this option is used to choose the version of Apache. Install/update it using "./build apache". Possible values: 2.4 (default: 2.4).

Web applications:
  • phpmyadmin - install/update phpMyAdmin using "./build phpmyadmin" or "./build all". Possible values: yes/no (default: yes).
  • squirrelmail - install/update SquirrelMail webmail using "./build squirrelmail" or "./build all". Possible values: yes/no (default: yes).
  • roundcube - install/update RoundCube webmail using "./build roundcube" or "./build all". Possible values: yes/no (default: yes).

Mail options:
  • exim - install/update Exim using "./build exim" or "./build all". Possible values: yes/no (default: no).
  • clamav - install/update ClamAV using "./build clamav" or "./build all". Possible values: yes/no (default: no).
  • dovecot - install/update Dovecot using "./build dovecot" or "./build all". Possible values: yes/no (default: yes).
  • eximconf - update exim configuration file (/etc/exim.conf) using "./build exim_conf" or "./build all". Possible values: yes/no (default: no).

Jailed shell options:
  • jail - install/update jailed shell programs using "./build all_jail". Possible values: yes/no (default: no).

FTP options:
  • ftpd - install/update FTP service using "./build pureftpd" (or "./build proftpd", depending on the setting value), or "./build all". Possible values: pureftpd/proftpd (default: pureftpd).

Statistics options:
  • awstats - install/update AWstats using "./build awstats" or "./build all". Possible values: yes/no (default: no).
  • webalizer - install/update webalizer using "./build webalizer" or "./build all". Possible values: yes/no (default: yes).

Crontab options:
  • cron - enable crontab for CustomBuild, use "./build cron" to set-up. Possible values: yes/no (default: no).
  • email - set email for notifications. Possible values: any email address (default: email@domain.com).
  • notifications - enable email notifications about the updates. Possible values: yes/no (default: yes).
  • da_autoupdate - Update DirectAdmin automatically when update is available. Possible values: yes/no (default: yes).
  • updates - update software/applications automatically when updates are available. Possible values: yes/no (default: no).
  • webapps_updates - update (automatically) only web applications (phpMyAdmin, RoundCube, SquirrelMail etc.). Possible values: yes/no (default: yes).
CustomBuild options:
  • custombuild - version of the CustomBuild script that you would like to use. Possible values: 1.1/1.2/2.0 (default: 2.0).
  • autover - this option is used to download versions.txt every time with every "./build" command. Possible values: yes/no (default: no).
  • bold - turn bolded text on/off. Possible values: yes/no (default: yes).
  • clean - execute "./build clean" every time. Possible values: yes/no (default: yes).
  • cleanapache - exclude apache from "./build clean". Possible values: yes/no (default: no).
  • clean_old_tarballs - execute "./build clean_old_tarballs" every time. Possible values: yes/no (default: yes).
  • clean_old_webapps -execute "./build clean_old_webapps" every time. Possible values: yes/no (default: yes).
7. Where are PHP-FPM configuration files located?
  • /usr/local/php53(54)/etc/php-fpm.conf - it is the main php-fpm configuration file.
  • /usr/local/php53(54)/lib/php.ini - PHP configuration file for php-fpm.
  • /usr/local/directadmin/data/templates/php-fpm.conf - it is the template for /usr/local/directadmin/data/users/*/php/php-fpm53(54).conf file.
8. Where the PHP-FPM log is located?
Code:
/usr/local/php53(54)/var/log/php-fpm.log
9. Why do I get "500 Internal server error"?
Check your PHP-FPM log and apache logs for any errors. The most common issues are:
  • php-fpm53(54) service was not reloaded after some manual changes done
  • socket files are removed from /tmp/fpm53(54)
10. How do I include this script by default with the DirectAdmin install?
Type the following before running the setup.sh:
Code:
echo "2.0" > /root/.custombuild
11. I've messed up my apache (httpd) configs, how I can restore working versions?
Type:
Code:
./build rewrite_confs
12. How to make PHP 5.3 or PHP 5.4 default for 1 host if both are installed as php-fpm or suphp?
Add this to .htaccess for PHP 5.3 as default for php-fpm:
Code:
<FilesMatch \.php$>
SetHandler php53-fcgi
</FilesMatch>
Add this to .htaccess for PHP 5.4 as default for php-fpm:
Code:
<FilesMatch \.php$>
SetHandler php54-fcgi
</FilesMatch>
If you use any other extensions (like .phtml or .phps), you need to add them to security.limit_extensions list in php-fpm configuration file.

Add this to .htaccess for PHP 5.3 as default for php-fpm:
Code:
<FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|phtml|phps)$">
AddHandler x-httpd-php53 .php
</FilesMatch>
Add this to .htaccess for PHP 5.4 as default for php-fpm:
Code:
<FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|phtml|phps)$">
AddHandler x-httpd-php54 .php
</FilesMatch>
13. How to make PHP 5.3 or PHP 5.4 default for 1 host if it's installed as mod_php?
Add the following code to .htaccess:
Code:
<FilesMatch "\.(inc|php|php3|php4|php44|php5|php52|php53|php54|phtml|phps)$">
AddHandler application/x-httpd-php .php
</FilesMatch>
14. How to update everything (what is managed by CustomBuild) using the script?
Firstly, you need to run:
Code:
./build update
To fetch the latest versions file.

Run this if you want to look what updates are available:
Code:
./build versions
Run this if you want to update everything what's possible:
Code:
./build update_versions
15. I have installed PHP 5.3 (or PHP 5.4) with php-fpm or suphp option. Where the configuration files (php.ini) could be found?
PHP 5.3 configuration file is located here: /usr/local/php53/lib/php.ini
PHP 5.4 configuration file is located here: /usr/local/php54/lib/php.ini

Extensions (zend, ioncube) are enabled here: /usr/local/php53(54)/lib/php.conf.d/directadmin.ini

16. I have installed PHP 5.3 (or 5.4) with php-fpm or suphp. Where the binary files could be found?
PHP 5.3: /usr/local/php53/bin/php53
PHP 5.4: /usr/local/php54/bin/php54

17. I have installed both PHP 5.3 and PHP 5.4 as php-fpm/suPHP, but I see a mod_php (CLI) version in /usr/local/bin/php. Why?
CLI version of PHP is needed for DirectAdmin. It must exist as CLI for DirectAdmin skins and plugins. However, /usr/local/bin/php is just a symlink to /usr/local/php53/bin/php53 (or /usr/local/php54/bin/php54)

18. How to fix "gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory"?
Code:
cp /usr/lib/libmysqlclient.* /usr/lib/mysql/
For 64-bit OS:
Code:
cp /usr/lib/libmysqlclient.* /usr/lib64/mysql/
22. I have installed PHP with php-fpm/suPHP/mod_ruid2 option and I get some errors when trying to use the webmail. Why?
You get them because some folders/files are owned by apache, and they need to be owned by the user. Use this to fix the problem:
Squirrelmail:
Code:
chown -R webapps:webapps /var/www/html/squirrelmail
Roundcube:
Code:
chown -R webapps:webapps /var/www/html/roundcube
19. Is it possible to use custom configuration files for PHP, Apache, suPHP, proFTPd, pure-ftpd?
Yes it is, CustomBuild checks for "custom" directory in /usr/local/directadmin/custombuild. So, just use:
Code:
cd /usr/local/directadmin/custombuild
cp -Rp configure custom
It will create custom directory for you, and now you can just edit configuration files from the custom directory. If you want - you can have only 1 custom configuration file, all the others will be used from "configure" directory then (and will be updated with "./build update").

20. I created a script that installs apache modules automatically, but I need to include their settings in httpd.conf file. Is there an easy way to do that?
CustomBuild creates ability to include modules settings easily into the apache configuration file. You just need to create a file in /etc/httpd/conf/extra (or the other directory) and include it in /etc/httpd/conf/extra/httpd-includes.conf. It will automatically load your settings and CustomBuild won't rewrite the file with "./build rewrite_confs". If you need a custom PHP or Apache configuration file - just upload it to custom directory. E.g. if you have /usr/local/directadmin/custombuild/custom/ap2/configure.php54 file it will use it instead of /usr/local/directadmin/custombuild/configure/ap2/configure.php54.

21. How to fix "configure: error: Size of "void *" is less than size of "long""?
You do not have /usr/local/lib in /etc/ld.so.conf file. Use the following commands to fix the problem:
Code:
touch /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
22. Is it possible to see what configuration files CustomBuild is using at the moment?
Yes, it is. CustomBuild has a new feature now:
Code:
./build used_configs
It will show something like:
Apache configuration file: /usr/local/directadmin/custombuild/configure/ap2/configure.apache
PHP (default) configuration file: /usr/local/directadmin/custombuild/custom/fpm/configure.php53
PHP (additional) configuration file: /usr/local/directadmin/custombuild/custom/ap2/configure.php54
ProFTPD configuration file: /usr/local/directadmin/custombuild/configure/proftpd/configure.proftpd
Files from the "custom" folder are detected too.

23. Is it possible to change an option without editing options.conf file?
Yes, it is. Just run:
Code:
./build set option_name value
24. Is it possible to make PHP more secure using the CustomBuild script?
Yes, it is. You need to run "./build secure_php". At the moment it disables some dangerous PHP functions as:
Code:
exec, system, passthru, shell_exec, escapeshellarg, escapeshellcmd, proc_close, proc_open, dl, popen, show_source
If you have any requests for the FAQ - feel free to post them into CB 2.0 subforum, questions will be added to FAQ.