I’m trying to include a file (/wp-load.php) at the beginning of the /html/ directory. I’m trying to include it from /wp-content/themes/pw-steel-orange/index-load.php, but I always get the error message
Warning: require_once(../wp-load.php) [function.require-once]: failed to open stream: No such file or directory in /nfs/c07/h01/mnt/102799/domains/platyworld.com/html/wp-content/themes/pw-steel-orange/index-load.php on line 1
Fatal error: require_once() [function.require]: Failed opening required ‘../wp-load.php’ (include_path=’.:/usr/local/php-5.2.6-1/share/pear’) in /nfs/c07/h01/mnt/102799/domains/platyworld.com/html/wp-content/themes/pw-steel-orange/index-load.php on line 1
Am I doing something wrong? I though ../ brings the includes to the beginning directory
Sorry if this is a duplicate, I couldn’t find something related to this in my searches…
You can issue the following command to see where you are pulling the file from (where you are at):
Then include the file accordingly.
If you are using a framework like CodeIgniter, for instance, there will be an
index.phpfile at the very start of your application that will be calling all other code. So you would have to include that file according to that file.Most frameworks use something they call a
BASEPATHthat is the current actual full server path to the site. This may prove very useful when migrating your site to another destination.