How to install PHP on CentOS 7

CentOS Tutorial–Hello everyone, this the CentOS tutorial series in order to build a powerful web server on CentOS. The last thing we need is to install php. Its pretty simple to install php on CentOS 7.

The following command is used to install php on CentOS 7

yum install php php-mysql


[root@centos-512mb-sgp1-01 ~]# yum install php php-mysql
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
 * base:
 * extras:
 * updates:
Resolving Dependencies
--> Running transaction check
---> Package php.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: php-common(x86-64) = 5.4.16-42.el7 for package: php-5.4.16-42.el7.x86_64
--> Processing Dependency: php-cli(x86-64) = 5.4.16-42.el7 for package: php-5.4.16-42.el7.x86_64
---> Package php-mysql.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-42.el7 for package: php-mysql-5.4.16-42.el7.x86_64
--> Running transaction check
---> Package php-cli.x86_64 0:5.4.16-42.el7 will be installed
---> Package php-common.x86_64 0:5.4.16-42.el7 will be installed
--> Processing Dependency: for package: php-common-5.4.16-42.el7.x86_64
---> Package php-pdo.x86_64 0:5.4.16-42.el7 will be installed
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

 Package                            Arch                           Version                                 Repository                    Size
 php                                x86_64                         5.4.16-42.el7                           base                         1.4 M
 php-mysql                          x86_64                         5.4.16-42.el7                           base                         101 k
Installing for dependencies:
 libzip                             x86_64                         0.10.1-8.el7                            base                          48 k
 php-cli                            x86_64                         5.4.16-42.el7                           base                         2.7 M
 php-common                         x86_64                         5.4.16-42.el7                           base                         564 k
 php-pdo                            x86_64                         5.4.16-42.el7                           base                          98 k

Transaction Summary
Install  2 Packages (+4 Dependent packages)

Total download size: 4.9 M
Installed size: 18 M
Is this ok [y/d/N]:

Finally, restart Apache web server

systemctl restart httpd



Leave a Reply

Your email address will not be published. Required fields are marked *