You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the above docker-compose.yaml file, we attach the local current directory test to the docker folder /var/www/html using volumes. This will allow the local changes we made in test directory during development will be sync to the docker image.
now run docker-compose up and visit localhost/index.php you can see the output Hello World, but if you visit localhost/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 the docker-compose.yaml file then it works as expected, it gives an apache default 404 error page on visiting localhost/index.PHP
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
Steps to reproduce:
test
index.php
file insidetest
Dockerfile
file insidetest
docker-compose.yaml
file insidetest
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
The text was updated successfully, but these errors were encountered: