docker-library / docker-library/php

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

Open
#973 4 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.