Click to See Complete Forum and Search --> : PHP Includes and Linux paths


tboneuls
06-09-2003, 12:02 AM
I had a script that worked great in Apache(OpenSA) under Win XP. When I try the same include on a server running apache under linux, i get the following error:

Warning: Failed opening 'var/www/html/dbaty/php/countdown/countdown4.php' for inclusion (include_path='.:/var/www/html/dbaty') in /var/www/html/dbaty/index.php on line 67

As you can see, I've tried changing the include path but it still doesnt work. What am I doing wrong?

Also, I had to turn register_globals on for the script to work in XP, and I have made the same change on the Linux server. What's wrong? Thanks.

TheIceman5
06-09-2003, 12:44 AM
to begin with if you have to have register globals on then your not a very good coder, that is if you wrote the script, if you didnt write it then the person who did is a poor coder.

Also, your include path is wrong, simple as that.

tboneuls
06-09-2003, 01:47 AM
I have tried all kinds of include paths.... and I can't seem to get the right one. The base of the site is in /var/www/html/dbaty/. what should the include path be? What exactly should that line in my php.ini read?

metalfox
06-21-2003, 12:45 AM
If your include path in php.ini is:

include_path='.:/var/www/html/dbaty'

Then your code is trying to open the include file

'/var/www/html/dbaty/var/www/html/dbaty/php/countdown/countdown4.php'

The '/var/www/html/dbaty' in the include_path is automatically prepended to your include() request unless your include() request begins with a '/'.

The correct include statement should either be:

include('/var/www/html/dbaty/php/countdown/countdown4.php');

or simply:

include('php/countdown/countdown4.php');