Search code examples
phpcommand-promptwampserverphar

Unable to pack my library back into a phar file


I have unpacked a phar file and now, I am trying to pack the phar file, but I keep getting an error. I am using wamp-server. I have looked at phpinfo() and modified the php.ini file. Here is the error I keep getting:

Executing phar files is disabled by php.ini setting 'phar.readonly'.

I have changed all my php.ini files to look like this:

[Phar]
; http://php.net/phar.readonly
;phar.readonly = Off

Even after all the changes are made, I still get the error. Is there something I do not understand? I have also modified all other .ini files in the php bins to make them look like this as well. Thank you so much for your help!


Solution

  • remove semicolon before phar.readonly to assign Off value to it. It should look like this:-

    [Phar]
    ; http://php.net/phar.readonly
    phar.readonly = Off
    

    Note:- If you want to change php.ini then first change its permission to write mode from read-only mode