URL file access?

software development

#1

How can I enable URL file access?
I just set up an account with DreamHost and moved my php-driven site over. I make numerous php require commands and I have the urls coded as absolute urls (http:// included) to avoid path mistakes. However, on migrating my files, my index page returns errors, the first of which being:

Warning: require() [function.require]: URL file-access is disabled in the server configuration in /home/.witness/hyperplex/hyperplexia.net/index.php on line 1

How can I enable URL file-access or otherwise remedy this problem? Thank you.


Andrew


#2

You essentially have three choices available to you:

  1. Setting a custom PHP.ini file
  2. Compile your own version of PHP
  3. Change your includes to take into account the fact that allow_url_fopen has been disabled

The last option is by far the best solution from a security standpoint. It means that your include statements will change from something like this:include("http://example.com/includes/include.php");to something like this:include($_SERVER['DOCUMENT_ROOT']."/includes/include.php");
si-blog
Max discount on any plan with promocode SCJESSEYTOTAL


#3

Thank you very much for the quick reply. I will try that and see how it works.


#4

This functionality is not supported by Dreamhost’s default PHP configuration. There are many discussions related to this subject in these forums. Just do a search for “allow_url_fopen”

And check the wiki here: http://wiki.dreamhost.com/Allow_url_fopen

EDIT
Whoops. Guess I was a little slow on the draw there.
EDIT


#5

I used the preferred suggestion above and it worked like a charm. Thank you very much.


#6

I’m glad it worked out :slight_smile:

si-blog
Max discount on any plan with promocode SCJESSEYTOTAL