Removing PHP ensures that existing files or services of PHP will not create conflict when we install PHP from source code. The following procedure will completely remove PHP from our system.
Let us get a list of all installed PHP packages. In the terminal, execute the following command.
# yum list installed *php*
OPTIONS EXPLAINED list Is used to list various information about available packages; more complete details are available in the List Options section. installed List the packages installed on the system specified by args. If an argument does not match the name of an available package, it is assumed to be a shell-style glob and any matches are printed.
NOTE: The escape character '' prevents our shell from parsing '*'. So that yum gets the global expression we intended, which is *php*.
We will get a list of all installed packages having php in their name.
NOTE: Repository information has been stripped from the below output.
php.i686 5.3.3-3.el6_2.8 php-cli.i686 5.3.3-3.el6_2.8 php-common.i686 5.3.3-3.el6_2.8 php-gd.i686 5.3.3-3.el6_2.8 php-ldap.i686 5.3.3-3.el6_2.8 php-mysql.i686 5.3.3-3.el6_2.8 php-odbc.i686 5.3.3-3.el6_2.8 php-pdo.i686 5.3.3-3.el6_2.8 php-pear.noarch 1:1.9.4-4.el6 php-pecl-apc.i686 3.1.9-2.el6 php-pecl-memcache.i686 3.0.5-4.el6 php-pgsql.i686 5.3.3-3.el6_2.8 php-soap.i686 5.3.3-3.el6_2.8 php-xml.i686 5.3.3-3.el6_2.8 php-xmlrpc.i686 5.3.3-3.el6_2.8
We can get a description of each of the above package by using the yum info command. For example, to get information on php.i686 package, execute the following command. The architecture spec i686 need not be specified.
# yum info php
OPTIONS EXPLAINED
info
Is used to list a description and summary information about available packages; takes the same arguments as in the List Options section.
Also we can get a list of all files with their locations, installed by a specific package, by using the rpm -ql command. For example, to get information on php.i686 package, execute the following command. The architecture spec i686 need not be specified.
# rpm -ql php
OPTIONS EXPLAINED -q query -l list files in package
The yum descriptions for each package is given below. It is for us to understand what each packages are, so that we can decide which of them to remove.
php.i686 PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated webpages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts. The php package contains the module which adds support for the PHP language to Apache HTTP Server. php-cli.i686 The php-cli package contains the command-line interface executing PHP scripts, /usr/bin/php, and the CGI interface. php-common.i686 The php-common package contains files used by both the php package and the php-cli package. php-gd.i686 The php-gd package contains a dynamic shared object that will add support for using the gd graphics library to PHP. php-ldap.i686 The php-ldap package is a dynamic shared object (DSO) for the Apache Web server that adds Lightweight Directory Access Protocol (LDAP) support to PHP. LDAP is a set of protocols for accessing directory services over the Internet. PHP is an HTML-embedded scripting language. If you need LDAP support for PHP applications, you will need to install this package in addition to the php package. php-mysql.i686 The php-mysql package contains a dynamic shared object that will add MySQL database support to PHP. MySQL is an object-relational database management system. PHP is an HTML-embeddable scripting language. If you need MySQL support for PHP applications, you will need to install this package and the php package. php-odbc.i686 The php-odbc package contains a dynamic shared object that will add database support through ODBC to PHP. ODBC is an open specification which provides a consistent API for developers to use for accessing data sources (which are often, but not always, databases). PHP is an HTML-embeddable scripting language. If you need ODBC support for PHP applications, you will need to install this package and the php package. php-pdo.i686 The php-pdo package contains a dynamic shared object that will add a database access abstraction layer to PHP. This module provides a common interface for accessing MySQL, PostgreSQL or other databases php-pear.noarch PEAR is a framework and distribution system for reusable PHP components. This package contains the basic PEAR components. php-pecl-apc.i686 APC is a free, open, and robust framework for caching and optimizing PHP intermediate code php-pecl-memcache.i686 Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory. This extension allows you to work with memcached through handy OO and procedural interfaces. Memcache can be used as a PHP session handler. php-pgsql.i686 The php-pgsql package includes a dynamic shared object (DSO) that can be compiled in to the Apache Web server to add PostgreSQL database support to PHP. PostgreSQL is an object-relational database management system that supports almost all SQL constructs. PHP is an HTML-embedded scripting language. If you need back-end support for PostgreSQL, you should install this package in addition to the main php package. php-soap.i686 The php-soap package contains a dynamic shared object that will add support to PHP for using the SOAP web services protocol. php-xml.i686 The php-xml package contains dynamic shared objects which add support to PHP for manipulating XML documents using the DOM tree, and performing XSL transformations on XML documents. php-xmlrpc.i686 The php-xmlrpc package contains a dynamic shared object that will add support for the XML-RPC protocol to PHP.
For removing PHP, we must remove all of the above packages. In the terminal, execute the following command.
# yum remove php php-cli php-common php-gd php-ldap php-mysql php-odbc php-pdo php-pear php-pecl-apc php-pecl-memcache php-pgsql php-soap php-xml php-xmlrpc
OPTIONS EXPLAINED
remove
Are used to remove the specified packages from the system as well as removing any packages which depend on the package being removed. remove operates on groups, files, provides and filelists just like the "install" command.(See Specifying package names for more information)
We will get a detailed list of all packages with their dependencies, ready to be removed. There will be also a [y/N] prompt, asking permission to continue.
NOTE: Repository information has been stripped from the below output.
================================================================================ Package Arch Version Size ================================================================================ Removing: php i686 5.3.3-3.el6_2.8 3.3 M php-cli i686 5.3.3-3.el6_2.8 6.3 M php-common i686 5.3.3-3.el6_2.8 2.9 M php-gd i686 5.3.3-3.el6_2.8 312 k php-ldap i686 5.3.3-3.el6_2.8 44 k php-mysql i686 5.3.3-3.el6_2.8 188 k php-odbc i686 5.3.3-3.el6_2.8 82 k php-pdo i686 5.3.3-3.el6_2.8 150 k php-pear noarch 1:1.9.4-4.el6 2.2 M php-pecl-apc i686 3.1.9-2.el6 310 k php-pecl-memcache i686 3.0.5-4.el6 160 k php-pgsql i686 5.3.3-3.el6_2.8 140 k php-soap i686 5.3.3-3.el6_2.8 332 k php-xml i686 5.3.3-3.el6_2.8 272 k php-xmlrpc i686 5.3.3-3.el6_2.8 80 k Removing for dependencies: graphviz-tcl i686 2.26.0-7.el6 1.4 M ibutils i686 1.5.7-6.el6 4.7 M piranha i686 0.8.5-19.el6 5.0 M Transaction Summary ================================================================================ Remove 18 Package(s) Installed size: 28 M Is this ok [y/N]:
If we remove PHP packages, the dependency packages will also be removed. That is a loss we have to take. The yum descriptions for dependency packages are given below.
graphviz-tcl Various tcl packages (extensions) for the graphviz tools. ibutils ibutils provides IB network and path diagnostics. piranha Various tools to administer and configure the Linux Virtual Server as well as heartbeating and failover components. The LVS is a dynamically adjusted kernel routing mechanism that provides load balancing primarily for web and ftp servers though other services are supported.
Type y and press Enter to continue. All the PHP packages along with their dependencies will be removed from the system.
You may go back to the following section.
Removing Apache HTTP Server