With YUM, upgrading php is simple as “yum install php”. This will install latest php version on your machine. But if you have multi different php modules that aren’t part of php package (eg. gd, mysqli …), than you can use this simple one liner and install all those modules at once.
Just run this as root:
php -m | grep -v "Modules" | while read i; do yum install php-$i -y; done
This will check for all currently installed php packages and will try to upgrade them.