I recently upgraded my Magento store to 2.3.1. The main store works just fine, however, my other store (multi-store instance) brings up this error:

Warning: stream_wrapper_unregister(): Unable to unregister protocol phar:// in /home/site/public_html/app/bootstrap.php on line 11

It then redirects to a report page, the relevant log file shows:

{"0":"Warning: Cannot modify header information - headers already sent by (output started at /home/site/public_html/app/bootstrap.php:11)}

I've cleared out the var/ folders, run the:

$ php bin/magento setup:upgrade
$ php bin/magento setup:di:compile
$ php bin/magento setup:static-content:deploy -f
$ php bin/magento cache:clean

Going to app/bootstrap.php line 11 shows:


Commenting it out works ... but that feels hacky and dirty.

What's the proper way to fix this?

Server info:

PHP: 7.2.16

CentOS 7


  • did you got any solution for this?
    – Piyush
    Commented Apr 12, 2019 at 10:41
  • Still looking for a solution for a very similar issue - however, when I commented out "stream_wrapper_unregister('phar');" - Checkout on mobile devices would get the spinning wheel of death. If you reloaded the page, then there was no issue. So if you have commented out the line, clear web data and cookies on your mobile and try to checkout without cached items. Maybe it's something in my setup, but I was glad I caught it and have no idea why it affects checkout on Safari.
    – dawhoo
    Commented Apr 15, 2019 at 17:46

1 Answer 1


The issue is after you modified your index.php file you left white space at the top prior to <?php OR you modified the end of the index.php file to include a ?> which it should not

I know this is very old, but i had the issue, im sure many looked this up, thought maybe it should include the solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.