Cant Use Fopen

Aug 2, 2009

i have a vps, and have a problem with fopen(a function php).
When i turn on iptables, i cant use fopen funtion.

here is my iptables rules

Code:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]

Allow returning packets
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Allow incoming traffic on ports 80 and 443 for web server
-A INPUT -p tcp --dport 80 -j ACCEPT
-A INPUT -p tcp --dport 10000 -j ACCEPT
-A INPUT -p tcp --dport 21 -j ACCEPT
Allow local traffic
-A INPUT -i lo -j ACCEPT

Allow ping
-A INPUT -p icmp --icmp-type 8 -j ACCEPT

Allow incoming SSH
-A INPUT -p tcp --dport 2200 -j ACCEPT
-A OUTPUT -d 72.233.69.3 -j ACCEPT
-A OUTPUT -d 72.233.69.2 -j ACCEPT
-A OUTPUT -d 66.135.58.62 -j ACCEPT
-A OUTPUT -d 66.135.58.61 -j ACCEPT
-A OUTPUT -d rest.akismet.com -j ACCEPT
-A OUTPUT -d api_key.rest.akismet.com -j ACCEPT
-A INPUT -s 127.0.0.1 -j ACCEPT

Ban ip
-A INPUT -s 213.152.242.28 -j DROP

COMMIT
and my php code

Code:
<?php
$handle = fopen("http://www.google.com/", "r");
if (!$handle) {
print "fopen doesn't work";
} else {
print "fopen seems to work";
}
?>

View 4 Replies


ADVERTISEMENT

Fopen Permission Denied On New Server

Jul 26, 2009

I'm migrating from shared hosting to a VPS. I have transferred my files right over, and permissions are all the same as they were on the old server.

The fopen scripts are giving me an error when trying to write to files.

Code:
failed to open stream: Permission denied

The permissions on the file are 644 and it can read from the file just fine. Giving the file world write permissions fixes the problem, but I don't want to do this for obvious reasons.

I think the reason this worked on the shared server had something to do with the apache user being defined differently but I'm honestly not sure. The php file executing the command is owned by the user that owns the document I'm trying to write to (in fact one user owns everything).

how I can fix this without giving world write permissions?

View 24 Replies View Related

Disabling Fopen("/etc/passwd","r");

Jul 18, 2007

I were seeing c99.php source code to know how it gets /etc/passwd file. it simply uses fopen() for this goal but I think fopen() is needed and I don't like it to be disabled in disabled_functions. I wonder how can I disable just fopen("/etc/passwd","r"); without doing any restriction to fopen function at all

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved