It is a simple task to upgrade (or install) PHP on Centos.
You can either install or upgrade PHP with a single command, as follows:
To upgrade PHP use yum command, as shown here:-
% yum update php
To install PHP use the yum command, as shown here:-
% yum install php