Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP file inclusion error
    primarykey
    data
    text
    <p>I am trying to create a <strong>config.php</strong> file similar as wordpress does. My code does create the file but i have been facing problem with file inclusions. I have a file <strong>defines.php</strong> in includes directory inside admin directory. But when, i include the file <strong>defines.php</strong> in my <strong>setup-config.php</strong> (in admin directory), i get the following error</p> <pre><code>Notice: Constant SS_ADMIN_BASEDIR already defined in C:\xampp\htdocs\cmsproject\ab_admin\defines.php on line 2 Notice: Constant SS_ADMIN_INCLUDES already defined in C:\xampp\htdocs\cmsproject\ab_admin\defines.php on line 3 Notice: Constant SS_ADMIN_IMAGES already defined in C:\xampp\htdocs\cmsproject\ab_admin\defines.php on line 4 Notice: Constant SS_ADMIN_CSS already defined in C:\xampp\htdocs\cmsproject\ab_admin\defines.php on line 5 Notice: Constant SS_ADMIN_JAVASCRIPT already defined in C:\xampp\htdocs\cmsproject\ab_admin\defines.php on line 6 </code></pre> <p>My defines.php file in include directory is as follows:</p> <pre><code>&lt;?php define('SS_ADMIN_BASEDIR',dirname(dirname(__FILE__)).'\\'); define('SS_ADMIN_INCLUDES','includes\\'); define('SS_ADMIN_IMAGES','images\\'); define('SS_ADMIN_CSS','css\\'); define('SS_ADMIN_JAVASCRIPT','javascript\\'); ?&gt; </code></pre> <p>A part of my setup-config.php is as follows:</p> <pre><code>&lt;?php require_once('includes/defines.php'); require_once(SS_ADMIN_BASEDIR . SS_ADMIN_INCLUDES . 'functions.php'); define('SS_ROOT_DIR',dirname(dirname(__FILE__)).'/'); //more code goes here, not related to the question ?&gt; </code></pre> <p>What i do in the root directory(index.php) is detect the config.php file and redirect to setup-config.php File index.php is as follows:</p> <pre><code>&lt;?php //First and foremost what we do is check if the config.php exists or not $fileName = dirname(__FILE__).'/config.php'; if(!file_exists($fileName) or is_dir($fileName)) header('Location:ab_admin/setup_config.php'); else echo "Load the template"; ?&gt; </code></pre> <p>So far, I know this error is displayed when a file is included multiple times in script using require or include. But i used require_once here, but still have problem. Does the version of xampp affect this? I was using xampp 1.7.3 and this code worked fine but i upgraded to xampp 1.8.3 and now things got messed up. <strong><em>Any help would be much appreciated. Thanks in advance.</em></strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload