phpiis-8phar

Running phar files from a browser


Is it possible to run .phar files from a browser? A couple of sites seem to suggest that it is, but I can't find any details on how to set it up.

I can run phar files directly from the CLI, but not from a browser. I'm using IIS. What do I need to do to make it work?

I'm on PHP 7.2 and IIS 8.5.

I know I can "include" them in regular php scripts, but I want to know how to run them directly.


Solution

  • You have to tell IIS that .phar files should be handled with the PHP CGI process.

    See https://learn.microsoft.com/de-de/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php

    In step 14 "Add Module Mapping", you need to set the "Request Path" to *.phar.