Jump to content


file_get_contents


5 replies to this topic

#1 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 06 October 2006 - 03:00 PM

alright, i recently switched hosts to dreamhost, but whenever i try to use the function file_get_contents it returns me this error, i need this to keep the player statistics up-to-date, its a gaming clan website.

'URL file-access is disabled in the server configuration in /home/**/**/**/update.php on line 12'

I sent in a support ticket and they told me i could compile my own php.ini. But what value do i change and how do i even compile a costum php.ini?? I've found some guides on the internet but they are very vague, they tell me to enter some commands or something, but i dont even know WHERE to enter them...

Heres a phpinfo file, if that helps any...

*removed*


Thanks for reading and help appriciated :D

Edited by rc69, 06 October 2006 - 03:44 PM.


#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 06 October 2006 - 03:49 PM

1. Making your phpinfo publicly viewable is not a good idea.
2. I've never seen that error before, but i can only assume it's because you're using the direct address to the file you're trying to modify (i.e. http://domain.com/foo.txt). If that's the case, use relative paths, they're far easier to update, and not as bad as people make them out to be.

Also, the value that is most likely to cause this error would most likely be allow_url_fopen, i don't know. You can check the php manual for more info. Then ask your host what you would have to do with your php.ini file once you've made the necessary changes.

#3 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 06 October 2006 - 04:19 PM

Alright, now where do get a php.ini 'template' to edit, do i just download it from php.net? Would it not be easier to pull off my current php.ini and only edit the desired values, since everything else is working fine and i dont want to mess anything up.

Im currently looking into changing php.ini values by using htaccess, without success so far... ;)

Also the reason i have to use full paths, im pulling the stats off a 3rd party site. :D

#4 Chaos King

    Senior Programmer

  • P2L Staff
  • PipPipPip
  • 676 posts
  • Gender:Male
  • Location:Florida

Posted 06 October 2006 - 04:28 PM

.htaccess won't change every php.ini value. Only certain values that the server administrator would allow you to change and etc. Thats one reason I think dreamhost is over-rated =) Their support is :D . Just run a google search, I am sure that someone else has that problem. As rc69 said, php.net is your first stop if DH can't help you. THEN google.

#5 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 06 October 2006 - 04:40 PM

well, i just found this in their wiki, seems like its a common problem
http://wiki.dreamhos...Allow_url_fopen

they DO offer alternatives for file_get_contents, which is a good thing...

http://wiki.dreamhos.../index.php/CURL

i will be looking into it further tommorow, its getting late :D

#6 Av-

    I Feel Left Out

  • Members
  • PipPipPipPip
  • 1,971 posts
  • Gender:Male
  • Location:10 ft. below sea level

Posted 07 October 2006 - 07:20 AM

yeah! i got it working now, i used the code from their wiki, using curl and made it into a function, file_get_contents_alt :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users