There is a file in the root of the site, for example /var/www/html/mysite/html/conf.php , but I don’t know the full path to it beforehand, only its name is known, how to include this conf.php file from the file that is executed in /html/img/conf/res.php

  • Isn’t that the “absolute path” - /html/conf.php ? Please clarify the text of the question by clicking edit - aleksandr barakin
  • this was not an absolute path to the file, but only from the root of the site, as far as I understand it - diego_costa
  • Well, write on the left path to the root of the site (the so-called document root ). - aleksandr barakin
  • document root shows the default folder in apache / var / www / html /, but what to do if the root of the site is in the folder / var / www / html / mysite / html / - diego_costa
  • there is a suspicion that you are trying to solve some problem that has not been heard in the question. start better from the beginning, not from the end. - aleksandr barakin

1 answer 1

Try

 echo $_SERVER['DOCUMENT_ROOT']; 
  • This function returns the path only to / var / www / html, and html / mysite / ... does not show - diego_costa
  • @diego_costa, proof , it says "which is specified in the server configuration file". It's great that you built such a tricky directory tree and put some meaning into it. But how does the program find out about this?) Reads your thoughts? - Alexander Belinsky
  • if I knew in advance that I would have to do it) it turns out that you need to edit the server config file to get access to the root via document_root? - diego_costa