To install PHP 5 on Red Hat Enterprise Linux 5, you can use the following steps:
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm sudo rpm -Uvh https://mirror.webtatic.com/yum/el5/latest.rpm
This will add the Extra Packages for Enterprise Linux (EPEL) and Webtatic repositories to your system, which contain packages for PHP 5.
sudo yum install php55w
This will install the latest version of PHP 5 available in the repositories.
sudo service httpd restart
This will apply the changes and make PHP 5 available to your web server.
Create a PHP file in the document root of your web server with the following code:
<?php phpinfo(); ?>
Save the file and access it from a web browser. You should see a page with information about your PHP installation, indicating that PHP 5 is working correctly.