Implement #1342
Test for #1342 (requires php-cgi)