Two servers, two different results when using include_once

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Feb 08, 2020 8:54 am

Sun Feb 09, 2020 10:01 am

I have a web app running on two servers, with exactly the same code on both servers (as far as I can tell). Exactly the same PHP version (5.5.38) and exactly the same PHP.ini file. ( l literally copied one to the other ). The servers are both running Windows Server 2016.

All my files include a file called common.php. This common.php itself includes a file called initialize.php, which then includes connect.php.

All three of these files (common,initialize and connect) exist in a directory off the root called "common". So the code I've always used to include these files is simple:

In each file in the root I have the following: include("common/common.php")

Inside common.php I have include_once("initialize.php")
Inside initialize.php I have include_once("connect.php")

This has always worked. Now on Friday for some reason, on server 2, in the middle of the afternoon all of this broke. ( I did change some javascript in another file that also exists in the common directory (prompts.php), but I don't believe I changed anything in the common.php file itself)

So now what's happening is on server 2, in the common.php file I need to include initialize.php with the folder prefix like so : include_once("common/initialize.php") and that works, but if I change it back to include_once("initialize.php") then it breaks.

This is only true on server 2. On server 1 I still have include_once("initialize.php") and it's fine. So what could be the difference on the two servers, that one of them now suddenly requires the path to the file, and the other one doesn't?

EDIT: Note that this applies only to the initialize.php file, and not connect.php. I can still include connect.php without the path, but initialize.php requires the path even though they're both in the same directory.
php-forum GURU
php-forum GURU
Posts: 653
Joined: Fri Apr 01, 2016 2:18 am

Mon Feb 10, 2020 1:25 am

i would try to have a look at the include path ... e-path.php
Post Reply