Knowledge Base

How Can We Help?

Add Custom PHP Modules with Custombuild in DirectAdmin

You are here:

 

PHP is a freely available scripting language that is primarily utilized for creating dynamic web pages. PHP is supported by the majority of web servers and operating systems. PHP extensions are add-ons primarily written in C programming language. They can be compiled with PHP to enable static or dynamic loading. PHP extensions are used to enhance various functionalities with a few additional components.

 

Listed below are the main reasons for utilizing PHP extensions:

1) To enhance PHP performance for specific functionalities such as arithmetic and statistics.

2) To achieve better performance and efficiency.

 

In this tutorial, we will discuss how to enable PHP extensions on a DirectAdmin server.

If you want to add an extra extension to PHP in DirectAdmin, you will need to compile it using the –with extension option.

 

1) First, you have to determine which configuration file the system is using. Login to the server via SSH as a root user and execute the following commands.

# cd /usr/local/directadmin/custombuild

# ./build used_configs | grep configure.php

It should look like this:

PHP (default) configuration file: /usr/local/directadmin/custombuild/configure/ap2/configure.php56

Make changes 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 include your –with-extension line at the end of the line.

Please ensure that the character exists at the end of all lines except the last one. The character tells the configuration line to continue on the next line, making the configuration settings easier to read. Without the character to trigger the line wrap, the next line becomes a separate command, which is incorrect. (see error below).

4) Once it is done, execute 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 through 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) Navigate to the custombuild directory.

# cd /usr/local/directadmin/custombuild

2) Enabling OpCache.

# ./build set opcache yes

3) Compile OpCache module.

# ./build opcache

4) Once it is done, check if OpCache is listed

# php -v

# php -m | grep -i zend

 

If you need any further assistance, please contact our support department.

 

Leave a Comment