S
S
sergeev_ev2018-07-02 17:11:31
PHP
sergeev_ev, 2018-07-02 17:11:31

Where is the $DOCUMENT_ROOT variable set?

Good afternoon.
Actually where is the $DOCUMENT_ROOT variable set?
No database connection after site migration.
Connecting to the database is written like this:
include_once "$DOCUMENT_ROOT/auth.php";

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sergeev_ev, 2018-07-03
@sergeev_ev

I took it from the old server and re-uploaded php.ini to which I transfer and voila, it worked.
Compared these php.ini with diff
Here's the difference:
https://docs.google.com/document/d/1qi8OqeKvWerbr_...

M
Mikhail Vasilyev, 2018-07-02
@mickvav

This is old code. On new php you have something like $_SERVER['DOCUMENT_ROOT'] - php.net/manual/en/security.globals.php

S
SagePtr, 2018-07-02
@SagePtr

And it is better to abandon DOCUMENT_ROOT altogether and address entry points relative to __FILE__, for example.
Where is the guarantee that no one will want to put your project in some subfolder of the virtual host and call it from there?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question