W
W
Weltmeister2020-05-11 13:21:38
PHP
Weltmeister, 2020-05-11 13:21:38

Absolute site paths in realpath?

There is a PHP page, at the beginning of which a config with a similar construction is connected:

define('PROJECT_DIR', realpath(dirname(__FILE__).'/../').'/');

The config is in a subdirectory.

Result: page and files give 404 - not found. How to solve the accessibility problem and specify the path correctly? Tried both /../ and /./ and other options, no change, or 500 error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2020-05-11
@FanatPHP

Elderberry in the garden, and uncle in Kyiv.
We connect the config in a file that is not found.
404 means the address was not found. If the web server didn't find the PHP file, that file didn't execute. If the PHP file did not start, then the matter did not come to a "similar design" at all.
To avoid 404, you must specify the correct path to the file, without any realpath, configs and other things.
realpath has nothing to do with 404 at all. Read until enlightenment: phpfaq.ru/newbie/paths

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question