Installation Of phpunit/PHPUnit Requires PHP Extension dom

So, you are trying to install phpunit/PHPUnit via pear and you got a message that PHP extension dom is required.

Here’s how your resolve it.

pear channel-discover

You would see output like:

Adding Channel "" succeeded
Discovery of channel "" succeeded

Next, install phpunit/PHPunit

pear install phpunit/PHPUnit

Oops. It fails. Sample message below:

Did not download optional dependencies: pear/Image_GraphViz, pear/Log, use --alldeps to download automatically
phpunit/PHPUnit requires PHP extension "dom"

The remedy to the problem appears to be printed in the error message.

pear install -a phpunit/PHPUnit

The -a option installs all required and optional dependencies. You can also type –alldeps in the place of -a.

dom is enabled at the time of PHP installation. If not, you have to install the PHP-XML or PHP-DOM package depending on the package naming conventions of your Linux distribution.

For Fedora you can use:

yum install php-xml

And then try

pear install -a phpunit/PHPUnit

Here’s a sample successful output:

pear install -a phpunit/PHPUnit
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.0)
downloading PHPUnit-3.3.5.tgz ...
Starting to download PHPUnit-3.3.5.tgz (269,292 bytes)
.....................................done: 269,292 bytes
install ok: channel://

For your information, the package php-pear-PHPUnit is available in the Fedora repositories. You can simply use

yum install php-pear-PHPUnit

if you don’t want to use pear install.

Copy from

By dbglory Posted in PHP

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s