After updating your system's repositories, install PHP:
Let's test the installation by checking the PHP version:
This should output something like this.
Note: Your output will be slightly different.
You now have the capability to run PHP from the command line.
Installing in Enterprise Linux distributions (CentOS, Scientific Linux, etc)
Use the yum command to manage packages in Enterprise Linux-based operating systems:
This installs a minimal install of PHP including some common features. If you need additional modules, you will need to install them separately. Once again, you can use yum to search for these packages:
To install the gd library:
Enterprise Linux distributions have always been conservative with updates, and typically do not update beyond the point release they shipped with. A number of third party repositories provide current versions of PHP:
IUS and Webtatic provide replacement packages with different names (e.g. php56u or php56w to install PHP 5.6) while Remi's repository provides in-place upgrades by using the same names as the system packages.
Following are instructions on installing PHP 7.0 from Remi's repository. This is the simplest example, as uninstalling the system packages is not required.
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0