1

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>

22
  • Maybe set ErrorLog explicitly in the VirtualHost block, re-start and re-check?
    – tater
    Aug 6, 2020 at 7:41
  • 1
    Is there anytihing in your apache configuration concerning PHP? Aug 6, 2020 at 8:30
  • 1
    Just to clarify, is the content of index.php "Hello world" as described, or is it php content like <?php echo "Hello world"; ?>?
    – tater
    Aug 6, 2020 at 9:40
  • 1
    It is "ldd", not "lld", or was that a double typo? Aug 10, 2020 at 9:14
  • 1
    I may try to duplicate your setup. What is your OS? Aug 10, 2020 at 9:29

1 Answer 1

0

Maybe Apache doesn't know when to use the php module? I found this apache cwiki

AddHandler application/x-httpd-php .php .phtml
Action application/x-httpd-php modules/libphp5.so

This how I started the container:

docker run --publish 9090:80  -v /tmp/project:/project kuborgh/php-5.2

/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,

docker run --publish 9090:80 --name xxproject -v /var/docker_mounts/xxproject:/project e28e8b71a1f7

I get an error, saying the image e28e8b71a1f7 isn't to be found.

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS                      PORTS               NAMES
bddc43202735        kuborgh/php-5.2     "/usr/sbin/apache2ct…"   18 hours ago        Exited (137) 16 hours ago                       eager_ride
$ docker run --publish 9090:80  --name AmehoelA -v /tmp/project:/project bddc43202735
Unable to find image 'bddc43202735:latest' locally
docker: Error response from daemon: pull access denied for bddc43202735, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
4
  • I tried this as this makes sense in my opinion but unfortunately it does nothing
    – CodeNinja
    Aug 7, 2020 at 8:58
  • You did put the correct location, I hope? Aug 7, 2020 at 15:17
  • Yes, /usr/lib/apache2/modules/libphp5.so
    – CodeNinja
    Aug 10, 2020 at 7:17
  • For some reason i could not get it working and it worked magically after removing everything (container and image) and start over again. I already removed the container but that did not work so i thing my image was broken/corrupt or something but it works now so thanks for all your effort!
    – CodeNinja
    Aug 12, 2020 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .