Skip to content

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

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=

12 thoughts on “XAMPP, PHP 5.3, PEAR, and PHAR (what a mess)

  1. @Pierre,

    Thanks for the links.

    @Jan,

    Actually I tried that and for some reason couldn’t make it work. Originally, i thought it was because the manual says that require_hash can’t be overridden but since that’s also how Greg recommends fixing the problem, possibly, I did something wrong. I will try it again.

    Thanks to the both of you for the comments.
    =C=

  2. I’ve also run into the same problem. If you don’t want to edit your php.ini:

    php -d phar.require_hash=0 PEAR/go-pear.phar

  3. Pingback: PEAR install weirdness at A cloud of thoughts
  4. Pingback: Lessons in Phar – techPortal
  5. Pingback: Packaging Zend Framework As A Phar Revisited – techPortal
  6. Pingback: SQLYog – A superficial review – techPortal

Comments are closed.