docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.79k stars 2k forks source link

Apache shows PHP code if .php in URL is not lowercase #1421

Closed nizar787 closed 1 year ago

nizar787 commented 1 year ago

If you enter a URL in browser pointing to a PHP file and .php at the end is not all lowercase (e.g. .phP, .pHp, .PHP, like example.com/index.PHP), Apache shows content of the PHP file. This is because of this config in /etc/apache2/conf-enabled/docker-php.conf:

<FilesMatch .php$> SetHandler application/x-httpd-php

To fix it, FilesMatch's regexp should be case-insensitive:

<FilesMatch .(?i:php)$> SetHandler application/x-httpd-php I can make a pull request but should the change be made in this file?

php/apache-Dockerfile-block-1

Line 45 in a80762e

echo '<FilesMatch .php$>'; \

tianon commented 1 year ago

Duplicate of #973 :eyes: