Answer the question
In order to leave comments, you need to log in
How to replace one php script with another without changing DOCUMENT_ROOT?
Good afternoon gurus!
There is a task, I ask for help in solving.
Bundle of nginx + apache. The user calls domain.ru/test.php
in the address bar , which contains a bunch of different code using the __DIR__, __FILE__ constants, globals and include-constructs.
It is necessary in any way to replace the source code with another file that lies in a directory other than DOCUMENT_ROOT.
You can edit apache and nginx configs, but adding\modifying files in the directory serving the domain.ru domain is prohibited.
Answer the question
In order to leave comments, you need to log in
Specify the required DOCUMENT_ROOT in the Apache/Nginx config for this site.
If you then need the source file, then in the new script, do the necessary actions, then chdir () and require () the source file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question