I'm a newbie of php.

I would like to create a php config file where to set the absolute path of my project directory structure.
My config file is located in 'private/class' directory and it will be included in 'root' and private directory files. 

Project directory structure is

```
class
img
photo
etc
private/class
private/photo
private/photo/thumb
private/etc

```

To get the absolute path where the file is located, I use magic php costants **DIR**, 

```
define('MAINPATH', __DIR__ );

```

this show

```
/var/www/projectname/private/class

```

and this variable remains the same if I include the config file in the index.php or private/index.php , etc.

Now I have the problem of finding the other path starting from the main one. 
Usually I use realpath, but in this case I do not think will go well. 
I tried in this way

```
define('PHOTOPATH', __DIR__ . '../photo');

define('PHOTOPATH', realpath ( __DIR__ . '../photo'));

```

these show

```
1 - /var/www/projectname/private/class../photo
2 - nothing

```

How could I do this? Thank you