docker-library / docker-library/php
Apache shows PHP code if .php in URL is not lowercase
Nobody has claimed this yet.
- Dominant language
- Dockerfile
- Stars
- 4k
- Forks
- 2k
- Avg merge
- 5d 21h
- Merged PRs (30d)
- 1
Description
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
</FilesMatch>
To fix it, FilesMatch's regexp should be case-insensitive:
<FilesMatch \.(?i:php)$>
SetHandler application/x-httpd-php
</FilesMatch>
I can make a pull request but should the change be made in this file? https://github.com/docker-library/php/blob/a80762e229981b94c9fe6c381637350e9104096a/apache-Dockerfile-block-1#L45
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apache-Dockerfile-block-1 at the referenced configuration section and inspect how it creates /etc/apache2/conf-enabled/docker-php.conf. Update the PHP filename matching so mixed- or uppercase .php URLs use the PHP handler, then verify behavior for lowercase, mixed-case, and uppercase extensions in the affected Apache image.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- apache, docker, php
- Domain
- backend, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100