On a 12 year old (web) server is still 1 old (custom) PHP application hosted. We want to shutdown this server and remove it from the rack. Unfortunately we still need the application, is not actively used anymore but needs to be available for archive purposes. The application does not support newer PHP versions than v5.2. For this reason i wanted to host the application in a docker container (https://hub.docker.com/r/kuborgh/php-5.2/dockerfile)
I started the container with docker run --publish 9090:80 --name xxproject -v /var/docker_mounts/xxproject:/project e28e8b71a1f7
which mounts my application folder (xxproject) on the host machine the /project
folder in the container. When i add a index.html
into my xxproject folder on my host and browse to ip:9090 i see the expected content.
When i exchange the index.html
with an index.php
file (content: Hello world
) i get a http 500
response.
When i check the apache error logs (in the container: docker exec -it xxproject bash
) i don't get any entry. The logs work because i can see a debug entry when i enter the website.
The /etc/apache2/sites-enabled/000-project.conf
(i added LogLevel debug
in the container for test purposes):
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /project
<Directory /project>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
LogLevel debug
</VirtualHost>
the only log entries in /var/log/apache2/error.log
[Thu Aug 06 06:47:00 2020] [debug] mod_deflate.c(700): [client 10.128.10.41] Zlib: Compressed 0 to 2 : URL /index.php
[Thu Aug 06 06:47:01 2020] [debug] mod_deflate.c(700): [client 10.128.10.41] Zlib: Compressed 0 to 2 : URL /index.php
I see the requests in the /var/log/apache2/other_vhost_names.log
172.17.0.3:80 10.128.10.41 - - [06/Aug/2020:06:47:00 +0000] "GET / HTTP/1.1" 500 375 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
172.17.0.3:80 10.128.10.41 - - [06/Aug/2020:06:47:01 +0000] "GET / HTTP/1.1" 500 375 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36"
When i check php -a
the interactive php terminal works like expected. How can i debug this issue further? I know that php 5.2 and Ubuntu 12 is deprecated and its not recommended to still use them but this is offtopic!
=====UPDATE 1=====
PHP configuration in apache (already set by default for the concerning docker image). I did not made any changes to the docker container except for the changes mentioned above.
root@63ca87239042:/etc/apache2# grep -ri -B 2 -A 2 php .
./mods-enabled/dir.conf-<IfModule mod_dir.c>
./mods-enabled/dir.conf-
./mods-enabled/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
./mods-enabled/dir.conf-
./mods-enabled/dir.conf-</IfModule>
--
./mods-enabled/php5.load:LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
--
./mods-available/dir.conf-<IfModule mod_dir.c>
./mods-available/dir.conf-
./mods-available/dir.conf: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
./mods-available/dir.conf-
./mods-available/dir.conf-</IfModule>
--
./mods-available/php5.load:LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
--
./sites-available/default-ssl- # directives are used in per-directory context.
./sites-available/default-ssl- #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
./sites-available/default-ssl: <FilesMatch "\.(cgi|shtml|phtml|php)$">
./sites-available/default-ssl- SSLOptions +StdEnvVars
./sites-available/default-ssl- </FilesMatch>
Maybe Apache doesn't know when to use the php module? I found this apache cwiki
This how I started the container:
/tmp/project is world read-, write- and searchable, the first index.php I put in there was executed succesfully when I visited http://localhost:9090/.
When I try, like you, to "docker run" with a docker id,
I get an error, saying the image e28e8b71a1f7 isn't to be found.