Closed svarup closed 11 months ago
That's because apache by default is case sensitive and the mapping for php is only for .php
and not .PHP
. You can solve you problem quite easily with sluign modifications.
Dockerfile:
FROM php:8.2.10-apache
RUN a2enmod speling
WORKDIR /var/www/html
COPY . .
Create an .htaccess
# Allow mixed case requests (mod_speling)
CheckSpelling on
CheckCaseOnly on
Now when accessing index.PHP
it goes to index.php
Duplicate of https://github.com/docker-library/php/issues/973
Steps to reproduce:
test
index.php
file insidetest
echo 'Hello World';
FROM php:8.2.10-apache
WORKDIR /var/www/html COPY . .
version: '3' services:
app: build: context: . dockerfile: Dockerfile image: app container_name: app volumes:
in the above
docker-compose.yaml
file, we attach the local current directorytest
to the docker folder/var/www/html
using volumes. This will allow the local changes we made intest
directory during development will be sync to the docker image.now run
docker-compose up
and visitlocalhost/index.php
you can see the outputHello World
, but if you visitlocalhost/index.PHP
then it will show blank page(you can see the php source code using view source), or it will download php file.if we remove the
volumes
part from thedocker-compose.yaml
file then it works as expected, it gives anapache default 404
error page on visitinglocalhost/index.PHP