Reputation: 16724
the following behaves different in host:
echo 'DIR:' .__DIR__; // DIR:__DIR__
localhost:(works fine):
DIR:C:\Program Files\VertrigoServ\www
why this different output?
Upvotes: 7
Views: 14115
Reputation: 2257
Try:
<? echo realpath(dirname(__DIR__)); ?>
Folder: localhost or root :)
Upvotes: 1
Reputation: 162831
According to the PHP magic constants docs, the __DIR__
constant was added only in php 5.3.0. You're probably using an older version in your "host" environment.
Upvotes: 2
Reputation: 47640
You need PHP 5.3 to use __DIR__
On previous versions you may use dirname(__FILE__)
instead
Upvotes: 31