Warning: Before doing anything, make backups!
Remove old versions of PHP and Apache
The old Apache and PHP versions in the server can conflict with the new install. So it is recommended to stop the web server and remove them using the commands:
sudo service httpd stop sudo service mysqld stop sudo yum remove httpd* php* mysqld*
Update the packages
New versions and patches for software get released often. That’s why it is always advisable to update the packages in the server.
Updating packages from the repository ensures that you get the latest secure versions and dependencies.
sudo yum clean all sudo yum update -y
Install new version of PHP, MySQL, and Apache
PHP/MySQL 5.6 works only with Apache 2.4, and they are available as a single package. Install then using:
sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
Lastly start it!
sudo service httpd start sudo service mysqld start