PHP require_once

I cant get this to work. Im trying to include a php file that is located somewhere else. It works fine if both files are in the same directory but once i change path it errors.

In my test.php i have this code

<?php require_once('http://DOMIAN/dir01/dir02/hi.php')?>

then in the other php file i have. This “hi.php” is located at http://DOMAIN/hi.php

<?php echo "this is from hi.php"?>

These are the errors
Warning: main() [function.main]: URL file-access is disabled in the server configuration in /home/PATH/TO/test.php on line 1
Warning: main(http://DOMAIN/hi.php) [function.main]: failed to open stream: no suitable wrapper could be found in /home/PATH/TO/test.php on line 1
Fatal error: main() [function.require]: Failed opening required ‘http:/DOMAIN/hi.php’ (include_path=’.:/usr/local/php5/lib’) in /home/PATH/TO/test.php on line 1

That’s not allowed - as the error message points out - “URL file-access is disabled in the server configuration”


If you need to retrieve data, use the alternative:

It’s not a good idea to execute source code after retrieving it from a web site. It makes your web site vulnerable to an evil person getting your web site to run their evil code.

:cool: Perl / MySQL / HTML CSS

Great thanks. I’ll work on that tomorrow. Had been messing with it for a few hours. bleh. Thanks for the answer!