Q:

PHP: require doesn' work

My directory root:
src/
   database.php
   Contact-Controller/
        contact.php

contact.php (None of these requires work):
require (__DIR__  . '/src/database.php');
require 'src/database.php';
require './src/database.php';

But on a other file
Directory:
src/
   Search-Controller/
        offer-count.php

On "offer-count.php" is require 'src/database.php working with no Error 500.
I don't understand, why on some files work require 'src/database.php and on other files not. Where is the error?

A:

You need to use .. to go to the parent directory of the current directory. So the correct way would be like this:
require '../database.php';

