How to install PHP on CentOS?

PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.

I’m not going to install all the modules available, just a few common ones so you get the idea.

root@webhosting24by7 ~]#yum install php

you’ll want to find any required PHP libraries in the yum repositories and install them. To see what PHP modules are available try a:

root@webhosting24by7 ~]#yum search php-

Note the “-” at the end of “php”. This will show any packages that start with “php5-“, along with a brief description

If you want to install extra PHP Modules then you can use “yum install” with a list of modules as the arguments. see the example :

root@webhosting24by7 ~]#yum install php-mysql php-devel php-gd php-mcrypt php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml

We must restart Apache after wards:

root@webhosting24by7 ~]#/etc/init.d/httpd restart