Reputation: 1101
I need to modify a PHAR file. Whenever I make changes to the file and then execute it I get the following error message:
Fatal error: Uncaught exception 'PharException' with message SHA1 signature could not be verified: broken signature'
By doing some research I found out that I can either
extract the phar, modify it and then "put it back into a phar file". How do I do that?
or set phar.require_hash = false
in my php.ini to disable the signature checking. This did not solve the problem unfortunately
I only have to do a few simple modifactions to the file and I'm the only one who is going to use it so I would prefer a quick and easy solution to the problem
Upvotes: 5
Views: 6277
Reputation: 586
The problem is that on the Symfony website the install command looks like this:
c:\> php -r "readfile('http://symfony.com/installer');" > symfony
The correct command is
c:\> php -r "readfile('http://symfony.com/installer');" > symfony.phar
And move the file symfony.phar
wherever you want to create your projects OR, just rename the file symfony
to symfony.phar
. If the file is named just symfony
you will get this error "sha1 signature could not be verified broken signature" because changing the name of the file will also invalidate the sha1 (that's how hashing works).
Upvotes: 4
Reputation: 31088
You cannot simply change the phar contents in an editor, just like you can't do that in a .zip
or .tbz2
file.
The only solution that will work is extracting the phar, modifying the extracted files and then re-packaging the phar file.
Upvotes: 0