Uploading variables to an external folder: only works once

I successfully use the following script to load session variables in other folders on my site:

<?php
require('../includes/configure.php');
ini_set('include_path', DIR_FS_CATALOG . PATH_SEPARATOR . ini_get('include_path'));
chdir(DIR_FS_CATALOG);
require_once('includes/application_top.php');
?> 

This script allows me to immediately load the header template, which includes the output of the variable that I want:

<?php
include('includes/templates/header.php');
?>

So, the fact is that this script works flawlessly in three other scripts (CMS-systems) ... For this particular one, which I am working on, it works only for the first time. It successfully loads my header and variables correctly, however it will not work the next time the page loads .

Can someone give an explanation / solution? Thank!

+3
source share
1 answer

, " " " ", , , - PHP. script:

ini_set('error_reporting', E_ALL);
ini_set('display_errors', 'On'); // shows in the web page instead of just logs

, , , .

-, include require. , PHP , . , require_once .

include. script, . PHP include script (, HTTP-). :

require dirname(dirname(__FILE__)) . '/includes/configure.php';
require dirname(__DIR__) . '/includes/configure.php'; // PHP5.3 only

: , . "" PHP - .

0

All Articles