Forum Moderators: coopster
I just set up a new VPS. I gave it Apache 2.2 and PHP 5.6.1.
I moved a site over that had been running for some months on a PHP 5.1.2 server, and immediately experienced failures.
This was because an included file was being referenced from the running PHP file, not the included file.
To wit:
With this structure:
/index.php
which includes:
/wp-content/plugins/my_plugin/my_plugin.php
which includes:
/wp-content/plugins/my_plugin/include_me.php
if(file_exists('wp-content/plugins/my_plugin/include_me.php')
{
require_once('wp-content/plugins/my_plugin/include_me.php');
} Don't worry about the prior test. There's a reason for it.
In any case, this code is inside a PHP file (/wp-content/plugins/my_plugin/my_plugin.php) that has been included into another file that is running at the top level (typical WordPress structure), so the path of the file in which this code appears is relative to the top level.
Now, when I moved it onto the new server, I had to change it; thusly:
if(file_exists('wp-content/plugins/my_plugin/include_me.php')
{
require_once('include_me.php');
} Now, THAT is wierd. Note that the file_exists() still checks from the top level, but the require_once() is relative to the include.
I suspect that I have neglected to set a flag in my PHP compile.
Any ideas?
I'm pretty sure I'll get it figured out today. One of my employees is a PHP expert. I'll ask him.
I use one config file and absolute paths inside the config file like this:
#####################
# INSTALLED MODULES #
#####################
// NOTEPAD MODULE
require_once($_SERVER["DOCUMENT_ROOT"].'/extranet/modules/notepad/config.php');
It works fine for me but Im sure others will have some thoughts.