PHP Include question

PHP Include question

Posted by: planetphillip
Posted on: 2005-06-15 12:55:00

Hi,

I have a free app that access a mysql db and lets users make changes. In the header file I have added:
<?php include('rotator.php'); ?>

This works perfectly (It's a simple random image function from A List Apart). The problem is I have three seperate installations of the app, looking at different databases and I would like to consolidate the files.

When I change the location of the .php file (So all three installations point to the same file (making it easy to update etc)). E.G.:
<?php include('http://www.planetphillip.com/siteimages/headers/rotator.php'); ?>

I get this mesage:

Warning: main(): URL file-access is disabled in the server configuration in (URL of header file)
Followed by a few other lines saying something about a suitable wrapper.

I would have included the whole text but wasn't sure whether the username and machine name should be kept private!

So, if you got this far and understood my problem, any ideas?

TIA

Phillip
http://www.planetphillip.com/
Commentary and Analysis of Sci-Fi Single Player First Person Shooters

Re: PHP Include question

Posted by: decswxaqz
Posted on: 2005-06-15 13:20:00

http://wiki.dreamhost.com/index.php/Allow_url_fopen

You can't use http type addresses when including or opening files.
If they are on the same server then just use relative address like '../includefile.php'.

From the wiki
include($_SERVER['DOCUMENT_ROOT']."/includes/example_include.php");

Re: PHP Include question

Posted by: planetphillip
Posted on: 2005-06-15 13:29:00

Great works perfectly, thank you.

Phillip
http://www.planetphillip.com/
Commentary and Analysis of Sci-Fi Single Player First Person Shooters

Tags: mysql dbphp includeaccess