0

today i got some confuseing error my __DIR__ is pointing to the System root directory, but i need the Apache2 root-dir

i tried to add

php_admin_value open_basedir /var/www/html

in apache2.conf and sites-aviable/000-default.conf

is there any option in php.ini?

i am using
PHP:

PHP 5.5.9-1ubuntu4.3


Apache:

Server version: Apache/2.4.7 (Ubuntu)
Server built:   Jul 22 2014 14:36:38


In my case

__DIR__ == "/var/www/html/"

May you can help me

cs8898
  • 28
  • 3

2 Answers2

0

There's no real way to do that. __DIR__ is an absolute path to the current file. There are many reasons you need to know this and it cannot be changed.

open_basedir is a directive to restrict what files PHP and Apache have access to in a given site. It's most commonly used in shared hosting environments to keep user A from accessing user B's files.

Machavity
  • 30,841
  • 27
  • 92
  • 100
0

__DIR__ is the path to the file which this code is located in. So if your script is in the root directory, __DIR__ would work as you want it to.

Vernard Luz
  • 281
  • 3
  • 7