The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. November 21, 2008, 03:26:31 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: File get contents  (Read 690 times)
esrun
Rookie
**
Offline Offline

Posts: 24


View Profile
« on: May 31, 2007, 03:42:11 AM »

I just setup a new server and I admit that general server setup is not my strong point. I'm getting the following error when I try to use file_get_contents on a remote file:

Warning: file_get_contents(http://www.yahoo.co.uk) [function.file-get-contents]: failed to open stream: Permission denied in /var/www/html/youlittlespunker/test.php on line 8

It works fine when I try to open a local file. I have enabled fopen thing in php.ini.

ANy ideas? I have been searching for a solution for awhile and I give up now.

Thanks
Logged
dink
Expert
****
Offline Offline

Posts: 319


View Profile
« Reply #1 on: May 31, 2007, 05:48:01 AM »

No expert, but I'd check that you have safe mode turned off.

My understanding is that safe mode doesn't allow opening remote files.
Logged

[quote Nutballs]
the universe has a giant fist, and its got enough whoop ass for everyone.
[/quote]
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 5138


:sniffle: Humor was so much easier before.


View Profile
« Reply #2 on: May 31, 2007, 08:54:51 AM »

Is this your box or VPS es, or a shared box?

The safe mode switches that would inhibit this activity are not on by default... either they would have to have been turned on in the in or switched in the compile line. Did you compile the PHP instance yourself? In any case, perhaps you could post the compile like (from the top of the phpinfo()) here so we could get a look.

Another outside idea is that there is some for of bot protection on the file... it's expecting something its not getting, so it's returning a deny code, so it looks like it's your local php but its actually the remote box. just thinking.
Logged

If I can't be Mr. Root then I don't want to play.
SEOidiot
Journeyman
***
Offline Offline

Posts: 71


^ Hes a pint sized Ned Flanders


View Profile
« Reply #3 on: May 31, 2007, 12:14:27 PM »

his box is a dedi

or so my surveillance cameras would lead me to believe  Roll Eyes
Logged

<mango>Yummmmmmmmmmmmm</mango>
<pie>ewwwwwwwwwww</pie>
esrun
Rookie
**
Offline Offline

Posts: 24


View Profile
« Reply #4 on: May 31, 2007, 03:25:50 PM »

Yeah its just another dedi. Safe mode is not on and I have enabled all the php.ini settings which are relevant to this. I have been advised by someone with a little more knowledge on the subject to just grab the latest version of php and recompile so I'll give this a go in the morning. Cheers guys.
Logged
esrun
Rookie
**
Offline Offline

Posts: 24


View Profile
« Reply #5 on: June 01, 2007, 06:54:36 AM »

Finally got it, it was /etc/sysconfig/selinux  Angry
Logged
thedarkness
Global Moderator
Lifer
*****
Offline Offline

Posts: 580



View Profile
« Reply #6 on: June 14, 2007, 04:29:28 AM »

Spleen->vent()

Seriously, selinux shits me, it has been responsible for so much wasted time it's incredible. I know people argue for it but FFS there must be a better way to do it that doesn't have such a hidden cost in terms of wasted/lost time.

My personal belief is that if an attacker makes it onto your box the battles already lost. Only sure security is not to let them on in the first place.

Cheers,
td

Logged

"I want to be the guy my dog thinks I am."
 - Unknown
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 5138


:sniffle: Humor was so much easier before.


View Profile
« Reply #7 on: June 14, 2007, 08:43:59 AM »

Agree - personal strategy is to put IPCop in front of everything, port translate to NAT translated box behind it. Shutdown all unnecessary services on destination box. Then use IPCop's VPN facility to get past it to talk to FTP, SSH etc. The only public service is on 80 and optionally 443.

The SELinux and hardened Solaris products just looked like too much of a PIA to me.


/p
Logged

If I can't be Mr. Root then I don't want to play.
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 5138


:sniffle: Humor was so much easier before.


View Profile
« Reply #8 on: June 16, 2007, 09:56:32 AM »

Note to TD: I split this thread because where you were going needs it's own thread.

And now back to our regularly scheduled topic...

/p
Logged

If I can't be Mr. Root then I don't want to play.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!