Can't Display PHP Errors with GZIP Enabled - Windows


(spitfire) #1

PHP errors are not showing if GZIP is enabled using Caddy 0.11.0 64-bit (Windows 10 64-bit).

This is the example Caddyfile:

Caddyfile

localhost:80 {
    root www
    errors visible
    log stdout
    gzip

    on startup php\php-cgi.exe -b 9001 -d xdebug.remote_connect_back=0 -d xdebug.remote_host=localhost &
    fastcgi / 127.0.0.1:9001 php
}

This is the example PHP file:

test.php

# $a is not defined
echo $a;

Accessing the PHP file from the browser displays

This site can’t be reached The webpage at http://localhost/test.php might be temporarily down or it may have moved permanently to a new web address.
ERR_CONTENT_DECODING_FAILED

If I disable GZIP in the Caddyfile

Caddyfile

localhost:80 {
    root www
    errors visible
    log stdout
#    gzip

    on startup php\php-cgi.exe -b 9001 -d xdebug.remote_connect_back=0 -d xdebug.remote_host=localhost &
    fastcgi / 127.0.0.1:9001 php
}

and rerun, the PHP errors are displayed properly with a call stack and error message:

PHP Notice: Undefined variable: a