Docker Community Forums

Share and learn in the Docker community.

Docker official image - Php7.3 (Apache) not able to change Document root

Dear Team

Trying to building PHP7.3 (Apache), and want to reset the DocumentRoot to /var/www instead of /var/www/html

  1. Have been successful to get the DocumentRoot in the etc/apache2/sites-available/000-default.conf

  2. The environment variable is correctly set
    root@e2fbf4922186:/usr/local/etc/php# set
    APACHE_CONFDIR=/etc/apache2
    APACHE_DOCUMENT_ROOT=/var/www
    APACHE_ENVVARS=/etc/apache2/envvars
    BASH=/bin/bash

  3. However, even after these changes, correctly reflected, the php7.3 is still picking the document root as /var/www/html
    (As a new user, I cannot post > 1 image, hence posting the text component of phpinfo() for the DOCUMENT_ROOT part.

    |DOCUMENT_ROOT|/var/www/html|
    |REQUEST_SCHEME|http|
    |CONTEXT_PREFIX|no value|
    |CONTEXT_DOCUMENT_ROOT|/var/www/html|

The Docker, compose files complete successfully - and result in working containers, EXCEPT for this issue

Any help, deeply appreciated.

Seems /var/www/html is hard-coded into the Dockerfile, look here. Because it appears at so many places there is no easy way to change it.

Tekki,

Thanks - I had an declaration in the compose file.

That has been fixed.

Alok

After more tinker with the httpd.conf record, I changed the DIRECTORY tab to state permit from all rather than deny from all.