How To Install php-pear-XML-Parser on CentOS 7

In this tutorial we learn how to install php-pear-XML-Parser on CentOS 7. php-pear-XML-Parser is XML parsing class based on PHP’s bundled expat

Introduction

In this tutorial we learn how to install php-pear-XML-Parser on CentOS 7.

What is php-pear-XML-Parser

This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation In “func” mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in “event” mode it uses a set of generic callbacks. Since version 1.2.0 there’s a new XML_Parser_Simple class that makes parsing of most XML documents easier, by automatically providing a stack for the elements. Furthermore its now possible to split the parser from the handler object, so you do not have to extend XML_Parser anymore in order to parse a document with it.

We can use yum or dnf to install php-pear-XML-Parser on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install php-pear-XML-Parser.

Install php-pear-XML-Parser on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install php-pear-XML-Parser using yum by running the following command:

sudo yum -y install php-pear-XML-Parser

Install php-pear-XML-Parser on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install php-pear-XML-Parser using dnf by running the following command:

sudo dnf -y install php-pear-XML-Parser

How To Uninstall php-pear-XML-Parser on CentOS 7

To uninstall only the php-pear-XML-Parser package we can use the following command:

sudo dnf remove php-pear-XML-Parser

References

Summary

In this tutorial we learn how to install php-pear-XML-Parser on CentOS 7 using yum and dnf.