Web Hosting Blog – Dewlance

How to Install the PHP Tidy Extension in DirectAdmin

The Tidy extension in DirectAdmin is not available by default, so you need to do some manual work. It’s very easy, and you don’t need to be a server expert.

First, we need to install the PHP Tidy development package. I am using a RHEL/CentOS/AlmaLinux-based OS, so I will use the yum command. For Ubuntu, you can use apt install instead of yum.

 

Step 1:

yum install libtidy-devel

Now, go to the DirectAdmin CustomBuild directory. Create a custom/php directory and copy the PHP config file to it. Change the PHP version according to your needs. I am enabling it on PHP 8.1, so I am using php81. If you want to enable it on PHP 8.2, replace php81 with php82 in the command below.

 

Step 2:

cd /usr/local/directadmin/custombuild

mkdir -p custom/php
cp -fp "configure/php/configure.php81" "custom/php/configure.php81"
cd custom/php
nano configure.php81

 

Step 3:

Add below line just before any -with-extension-name \ line.

--with-tidy \

Example:

Before:

–with-zip \
–enable-bcmath \

After: 
–with-zip \
–with-tidy \
–enable-bcmath \

 
Save your changes.

 

Step 4

Go back to the custom build directory of DirectAdmin.

cd /usr/local/directadmin/custombuild

Now, get the PHP slot for your PHP version from the options.conf file in DirectAdmin.

grep -P 'php[\d]_' /usr/local/directadmin/custombuild/options.conf 

Output will be something like:

php1_release=8.2
php1_mode=fastcgi
php2_release=8.1
 
PHP 8.1 is using the php2 slot. Note it.

 

Step 5

Now, we’re going to recompile the PHP version. Since we only enabled Tidy on PHP 8.1, I will compile only PHP 8.1 to save time.

Replace php2 in below command with the slot number we get in the step 4.

cd /usr/local/directadmin/custombuild
./build php_expert 8.1 php2

 

If you are using the php-fpm handler, you should also include it in the command: 

./build php_expert 8.1 php2-fpm

 

Step 6:

./build rewrite_confs

Finally, you know how to enable PHP Tidy extension in DirectAdmin Hosting Control Panel. If you are interested in such useful tutorials then you can also purchase video tutorials from DemoTiger for your hosting company or blog.

Note: This is not AI written. Please do not copy our article without prior written permission from Dewlance owner.

Exit mobile version