CentOS / RHEL: Install php-tidy Module / Extension
To install the php-tidy module on CentOS or Red Hat Enterprise Linux (RHEL), follow these steps:
- 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- Use the following command to install the
php-tidyextension:
sudo yum install php-tidy- Once the installation is complete, restart the web server to apply the changes:
sudo systemctl restart httpd- Verify that the
php-tidyextension has been installed and is enabled by creating a PHP script with the following contents:
<?php
phpinfo();
?>- Save the script and access it in a web browser. Look for the section labeled "tidy" in the output, and verify that the
php-tidyextension is listed and enabled.
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.