397,551 Members | 3,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 397,551 IT Pros & Developers. It's quick & easy.

php5 URL file-access is disabled

hinksta
P: 52
I have a php page that has an include. when using php4 I needed to put the whole url http://www etc. to get the include to load, thought it a bit strange but left it.
Now I can turn on php5, so I did, the include stopped working because URL file-access is disabled. I tried again without the url but it still wouldn't work.

Does anyone know what i'm talking about and what to do?
Oct 28 '07 #1
Share this Question
Share on Google+
5 Replies


pbmods
Expert 5K+
P: 5,821
Heya, hinksta.

In your php.ini file, look for this line:
Expand|Select|Wrap|Line Numbers
  1. allow_url_fopen = Off
  2.  
Change it to:
Expand|Select|Wrap|Line Numbers
  1. allow_url_fopen = On
  2.  
If that doesn't work, then you'll need to have a word with your hosting provider.
Oct 28 '07 #2

hinksta
P: 52
thanks pbmods, where should php.ini be? should I be able to get the incdlude to work without the url?
Oct 28 '07 #3

hinksta
P: 52
I uploaded php.ini to my root but it didn't get it going.
Oct 28 '07 #4

pbmods
Expert 5K+
P: 5,821
Heya, hinksta.

If the file is located on the same server, you can provide a local path to the file:
Expand|Select|Wrap|Line Numbers
  1. include 'somefile.php';
  2. include 'relative/path/to/somefile.php';
  3. include 'absolute/path/to/somefile.php';
  4.  
  5. // Or the ever-popular...
  6. include dirname(__FILE__) . '/relative/path/to/somefile.php';
  7.  
You can also set where PHP looks for include()d and require()d files by setting the include_path setting.
Oct 28 '07 #5

hinksta
P: 52
This is the strange thing, I have other includes on the same page that load ok with the local path.
This one will not, the only thing I can see that's different is it's making a query ie: file.php?doing=something could that be the problem?
Oct 28 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.