To upgrade php, first you must include the Webtatic EL yum repository data relating to your CentOS/RHEL variant to yum:
For CentOS/RHEL 7:
# rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
# rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
After installing Webtatic yum repository, you have to remove the old version of php-common package. It will also delete it dependencies packages.
# yum remove php-common
Now we install PHP 5.5 using following command:
# yum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
If you are running nginx web server with php-fpm then you need to install php fpm as below
yum install php56w-fpm -y
After installing PHP 5.6, we need to restart Nginx service.
sudo systemctl restart php-fpm
sudo systemctl restart nginx