使用未定义的常量__DIR__ [重复]

I am getting following error:

Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in /home/a2708294/public_html/firebase/index.php on line 58

Line:58

require_once __DIR__ . '/firebase.php';
require_once __DIR__ . '/push.php';
</div>

The magic constant __DIR__ was added in PHP version 5.3.0 You can check it here: http://php.net/manual/en/language.constants.predefined.php

You need to upgrade php to a newer version. Anyway you need to upgrade because you have a very old version.

If you can't upgrade php you can use dirname(__FILE__) as a hack because magic constant __FILE__ is in PHP from version 4.0.2

So your code will look like this:

require_once(dirname(__FILE__) . '/firebase.php');
require_once(dirname(__FILE__) . '/push.php');

DIR The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(FILE). This directory name does not have a trailing slash unless it is the root directory.

http://php.net/manual/en/language.constants.predefined.php