The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
The problem is with the include() functions. On Windows, all includes are relative to the top level file, so if I include B in A, and C in B, then I must specify the path of C in B with respect to A.
However, when I uploaded to the server, it wanted some of the paths relative to the top level and some relative to the current level. It seems totally inconsistent. Any ideas why? Have they changed how includes work in PHP5?
> Any ideas? I'm sure PHP used to parse URLs relative to the current
> file being executed and not the top level file - was that not the
> case?
>
Actually did some more testing, PHP supports both (tried using 5.0.2 and 4.3.9), includes appear to work with paths relative to the current script and the working directory (location of the top level script). The only exception is if the include starts with .. and then it looks relative to the working directory only. And thats consistent with what the manual says too.
Basically the behaviour you have on your linux server is correct as best I can see from the includes you've shown.
File - admin/blocks/header.php
On your PHP 5, if you have include("menus/main.php"); instead it really wont work? If not, looks like its corrupt in some way.
Btw, also read about a work around for this type of thing which seems to work quite nicely. Just put dirname(__FILE__)."/" at the front of all your include paths and you'll always be dealing with paths relative to the current script. So if include("menus/main.php"); doesn't work in PHP 5, maybe include(dirname(__FILE__)."/"."menus/main.php"); does.
include_path = .:/usr/share/pear
open_basedir = /data/www/
and on my Windows machine:
include_path = .;C:\php5\pear
open_basedir = no value
Any ideas? I'm sure PHP used to parse URLs relative to the current file being executed and not the top level file - was that not the case?
Also, do you use MSN Messenger?
The documented behaviour is that paths should be relative to the top level file being executed, ie what your windows machine is doing. As for it being inconsistent on the linux server, you might be just getting lucky especially likely if your include_path has both the document root and '.' .
And it doesn't appear to be a php.ini or Apache httpd.conf setting - we tried changing any relevant settings on the remote server to match a server known to work the same.
Even within scripts being parsed on the remote server, it is handling them differently - look at the way it links some of the includes - it's just plain inconsistent.
"If filename begins with ../, it is looked only in include_path relative to the current working directory."
If include_path is defined to something other than the document root then you'd get that effect. I guess the way around the differences it to make the include paths absolute.
File - admin/index.php
File - admin/blocks/header.php
File - admin/verifylogin.php
File - includes/dbconnect.php
File - admin/blocks/menus/main.php
Those work fine on my Windows setup with PHP5, but on the Linux server with PHP4 they have to be changed to:
File - admin/index.php
File - admin/blocks/header.php
File - admin/verifylogin.php
File - includes/dbconnect.php
File - admin/blocks/menus/main.php
It just seems really inconsistent.
You could get that effect from the apache configuration which to me seems a more likely cause.
The problem is with the include() functions. On Windows, all includes are relative to the top level file, so if I include B in A, and C in B, then I must specify the path of C in B with respect to A.
However, when I uploaded to the server, it wanted some of the paths relative to the top level and some relative to the current level. It seems totally inconsistent. Any ideas why? Have they changed how includes work in PHP5?