Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Require Once Not Working
10-07-2013, 07:08 AM #1
- Join Date
- Jan 2013
- Thanked 0 Times in 0 Posts
Require Once Not Working
I have a couple of folders in my directory on is called system and other catalog. There is also a file called index.php
The stuff that was on there I have copied that to a new file location in system the file is called startup.php this is now required once on index.php
It doesn't seem to work this way
<?php require_once(DIR_SYSTEM . 'startup.php'); ?>
<?php require_once('system/startup.php'); ?>
10-07-2013, 02:48 PM #2
- Join Date
- Sep 2002
- Saskatoon, Saskatchewan
- Thanked 2,660 Times in 2,629 Posts
If your directory paths have changed, you have likely broken it.
PHP searches on two initial conditions: the current working directory of the EXECUTING script, and the include_path if not found in the current working directory.
If you've changed the directories the files are in and they do have reliance on each other, than you must ensure that they are loaded from the current working directory of the executing script.
Your options are either to:
- Provide an absolute path
- Add a base to the include_path
- Create relative from this file by making use of __DIR__ or dirname(__FILE__) on older versions of PHP.
Of course, that assumes an issue with loading an included script. Since you've posted no errors and no description of a problem, I have simply guessed that.
header('HTTP/1.1 420 Enhance Your Calm');