PEAR on PHP 5.5: could not extract package.xml

by  on 
27 Mar

After reinstalling the laptop setting up Zend Server 7.0 as the local enviroment, I ran into some issues when trying to install PHP Unit.

Specifically “could not extract the package.xml file” and “Error: cannot download “phpunit/PHP_Timer”, when running the command:

pear install phpunit/PHP_Timer

Turns out that from PHP 5.5.3 the pack/unpack format strings slightly different than the default Perl behavior, breaking backwards compatibility. This was updated with Pear version 1.3.11, but for some reason I was unable to update the pear version using Zend Server.

You can find out what Pear version you run by typing:

pear info archive_tar

It should return something like the string below, followed with the various settings.
ABOUT PEAR.PHP.NET/ARCHIVE_TAR-1.3.8

It was easy enough to solve the issue by downloading and applying the patch.

About the author Formally educated as an electronics engineer, Sven moved on to web development in 2004 after having it as a hobby for almost a decade. Over the last few years he has accumulated a vast knowledge and experience in the field of complicated web-based applications working with everything from transaction based systems to high traffic websites.

He is passionate about clean, efficient and secure code. When working on a project he will not budge until every security aspect has been taken care of.