sprintcube/docker-compose-lamp

[Issues] $_SERVER['DOCUMENT_ROOT'] & No such file or directory

TinTikls opened this issue · 0 comments

which Branch / PHP Version are you using ?
php8.2.1

Expected behavior

Hi. I'm new to docker, I've used openserver before, so I ran into this idiotic problem, but I couldn't solve it.
I use $_SERVER['DOCUMENT_ROOT'] to connect my files, but since apache document root is in a different default folder, it can't find the files I need because they are not there, respectively.

I changed APACHE_DOCUMENT_ROOT: ${APACHE_DOCUMENT_ROOT-/var/www/html} to the path of my project, and also did this in the .env file, but after that I get a 403 error.

The apache log is.
[Tue Jan 10 23:12:03.613929 2023] [authz_core:error] [pid 18] [client 172.18.0.1:60276] AH01630: client denied by server configuration: /var/projects, referer: http://localhost/

In ./config/vhost/default.conf I have set
<Directory ${APACHE_DOCUMENT_ROOT}
require all granted

I also tried
AllowOverride all
Allow from all

I also set it recursively to 777 for all the folders beginning with www

This has no effect and I get an error.

The only possible solution to this problem and running the project locally is to specify full paths to files on the system, then it finds them. But this way I will break my application in web.

Is there any other solution to my idiotic problem?

  • Ubuntu
  • Docker version 20.10.22, build 3a2c30b