Add Custom PHP Modules with Custombuild in DirectAdmin
Posted on February 25th, 2019
PHP is an open source scripting language which mainly used to create dynamic web pages. PHP is supported by most of the web servers and OSs. PHP modules are extensions mostly written in C language. It can be compiled with PHP to enable static loading or dynamic loading. PHP modules are used for different purposes with only a few extensions.
Here are the main reasons to use PHP modules.
1) To extend a PHP functionality for a particular purpose like mathematics, statistics, etc.
2) To get higher performance and efficiency.
In this tutorial, we will discuss how to enable a PHP modules on DirectAdmin server.
If you want an additional module to PHP in DirectAdmin, you will need to compile with option –with module.
1) First, you have to find out which configuration file that system is using. Login to the server through SSH as a root user and run the following commands.
# cd /usr/local/directadmin/custombuild
# ./build used_configs | grep configure.php
It looks like:
PHP (default) configuration file: /usr/local/directadmin/custombuild/configure/ap2/configure.php56
Change in the values if they are different.
2) Run the following command to add this flag.
# cd /usr/local/directadmin/custombuild
# mkdir -p custom/ap2
# cp -fp configure/ap2/configure.php56 custom/ap2/configure.php56
3) Open the file /usr/local/directadmin/custombuild/ap2/configure.php56 and add your –with-module line to the end of the line.
Please make sure the \ character exists at the end of all lines except the last one. The \ character tells the line to configure, line to loop to the next line, making the configure settings easier to read. Without the \ character to trigger the wrap, the next line becomes a separate command, which is not correct. (see error below).
4) Once it is completed, run the following command.
# cd /usr/local/directadmin/custombuild
# ./build php n
5) Then restart apache.
# /sbin/service httpd restart
Zend OpCache Installation Steps.
Zend OpCache provides faster PHP execution via opcode caching and optimization. It improves the performance of PHP.
Here are the steps to install Zend OpCache on DirectAdmin with custombuild 2.0.
1) Enter into the custombuild directory.
# cd /usr/local/directadmin/custombuild
2) Setting OpCache to yes.
# ./build set opcache yes
3) Compile OpCache module.
# ./build opcache
4) Once it is completed, check if OpCache is listing
# php -v
# php -m | grep -i zend
If you need any further help, please do reach our support department.
I looking at starting with a 2 slice VPS. Can I set PHP limits in mem allocation 768M, file upload size 256M, max execution time of 300? If I need to increase the number of slices required, how quickly can that be achieved?
Bob