planet-ibuildings

XAMPP, PHP 5.3, PEAR, and PHAR (what a mess)

by planet-ibuildings | Comments Off | July 11, 2009

Dear Reader,

The Short Version

If you are installing PHP 5.3 and when you run go-pear.bat you get this:

phar "C:\xampp\php\PEAR\go-pear.phar" does not have a signature

Edit your php.ini file and find the lines:

; http://php.net/phar.require-hash
; phar.require_hash = On

Change them to :

; http://php.net/phar.require-hash
phar.require_hash = Off

Save and then run

go-pear

The Long Version

As the sun arose and illuminated the sky, I thought as I was waking up that today would be a good idea to upgrade my local install of PHP to 5.3. This is proof, once again, that I should not listen to the voices in my head…ever.

XAMPP

I use XAMPP as my WAMP stack. The first thing I did was go out and check to see if they have released a version with 5.3. Sadly, they had not, as of this writing. (I found that odd because they are usually very punctual on these things) Since they didn’t have it, I decided to just grab the binaries from php.net and do it myself. (How hard could it be, right?)

PHP.NET

Ok, the first thing you have to decide with PHP on Windows is which version. Looking through my options, VC6 x86 Non Thread Safe seemed to be the one I needed. Since I already had PHP installed and just wanted to update it, I decided on the ZIP instead of the installer. (I was pretty sure the Debug Pack wasn’t what I was looking for)

Download, Unzip, rinse repeat. You know how this part goes. XAMPP puts php in c:\xampp\php. I simply moved that out of the way, made a new one and unzipped the contents into it. This is where things got a bit weird.

PEAR and PHAR

My PEAR dir was now empty except for go-pear.phar. Since my php directory had go-pear.bat I figured, what the heck, I’ll give it a shot. No dice, this time. As soon as I executed the batch file, I got:

phar "C:\xampp\php\PEAR\go-pear.phar" does not have a signature

Hmmm….that’s new.

Ok, some quick googeling around found me this possible solution from Thijs Lensselink. I tried it, nope, would not work. However, it did lead me down the correct path. I started digging into the Phar manual to find out what the require_hash options was all about. It turns out that, if that’s on, for security purposes it can’t be overridden. Since the default is on, I had to open up my php.ini, find it and set it to off. Once it’s off, everything works just fine.

Edit your php.ini file and find the lines:

; http://php.net/phar.require-hash
; phar.require_hash = On

Change them to :

; http://php.net/phar.require-hash
phar.require_hash = Off

Conclusion

I’m not sure why the go-pear.phar doesn’t contain a valid hash, I assume the PEAR group will fix that in 5.3.1. Until then, just make sure you at least temporarily set require_hash=Off in your php.ini and you should be good to go. It’s probably a good idea to turn it back on when you’re done.

Until next time,
(l)(k)(bunny)
=C=

  Tags: pear, phar, PHP, require_hash, xampp

Related posts

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Most Commented Posts

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.