Skip to content

Instantly share code, notes, and snippets.

@olliebun
Last active December 23, 2015 12:09
Show Gist options
  • Save olliebun/6633594 to your computer and use it in GitHub Desktop.
Save olliebun/6633594 to your computer and use it in GitHub Desktop.
Getting the path to a PHP file without resolving symlinks.
$ ln -s test.php foo.php
$ php test.php
/home/vagrant/test.php
$ php foo.php
/home/vagrant/foo.php
<?php
print($_SERVER['PWD'] . "/" . $_SERVER['PHP_SELF']);
@olliebun
Copy link
Author

Looks like through apache you don't have $_SERVER['PWD'], though.

@michaelsharman
Copy link

We pretty much use this everywhere:

require_once __DIR__ . '/app.php';

FILE isn't used in LearnosityPackages at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment