Skip to content
TrySitePrice

CentOS / RHEL: Install php-tidy Module / Extension

Best/Tutorial

To install the php-tidy module on CentOS or Red Hat Enterprise Linux (RHEL), follow these steps:

  1. Ensure that you have the correct repository enabled for your version of CentOS/RHEL. For example, for RHEL 7, you need to enable the EPEL repository:

sudo yum install epel-release

  1. Use the following command to install the php-tidy extension:

sudo yum install php-tidy

  1. Once the installation is complete, restart the web server to apply the changes:

sudo systemctl restart httpd

  1. Verify that the php-tidy extension has been installed and is enabled by creating a PHP script with the following contents:

<?php

phpinfo();

?>

  1. Save the script and access it in a web browser. Look for the section labeled "tidy" in the output, and verify that the php-tidy extension is listed and enabled.

The php-tidy extension should now be installed and ready for use on your CentOS/RHEL system. You can use it to clean and format HTML code within your PHP scripts, improving the readability and maintainability of your code.