Results 1 to 5 of 5

Thread: Cant use fopen

  1. #1

    * Cant use fopen

    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
    :INPUT DROP [0:0]
    :FORWARD DROP [0:0]
    :OUTPUT ACCEPT [0:0]
     Allow returning packets
     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 -j ACCEPT
    -A OUTPUT -d -j ACCEPT
    -A OUTPUT -d -j ACCEPT
    -A OUTPUT -d -j ACCEPT
    -A OUTPUT -d -j ACCEPT
    -A OUTPUT -d -j ACCEPT
    -A INPUT -s -j ACCEPT
    Ban ip
    -A INPUT -s -j DROP
    and my php code
    $handle = fopen("", "r");
    if (!$handle) {
        print "fopen doesn't work";
    } else {
        print "fopen seems to work";
    do u have any ideas? thanks

  2. #2
    Join Date
    Jun 2003
    World Wide Web
    Confirm fopen is not listed under disable_functions in php.ini

    Also confirm safe_mode is disabled. - the name says it all!
    Managed Cloud Servers
    Server Management and Monitoring
    24x7 outsourced customer support

  3. #3
    Join Date
    Jun 2009
    Check for fopen in your php.ini file which is located at /usr/local/lib/php.ini
    It should be like this for the fopen to get working
    ; Fopen wrappers ;

    ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
    allow_url_fopen = On
    Ezeelogin -
    The ultimate multiple server administration software.
    *Parallel shell *rm -rf protection *SSH logging*automated password changes*encrypted storage* -Delivering innovative web hosting solutions

  4. #4
    i already set allow_url_fopen=on. And when i turn off iptables, fopen will work

  5. #5
    Join Date
    May 2008
    Since you're using allow_url_fopen to open a remote URL/file, can you make sure you have added the IP address of the remote server in the outbound traffic chain ?
    Twitter :
    Contact Us : support[at]

Similar Threads

  1. php fopen 404 problem
    By sasha in forum Programming Discussion
    Replies: 4
    Last Post: 01-31-2008, 09:42 AM
  2. fopen() Help
    By M3TechSolutions in forum Programming Discussion
    Replies: 11
    Last Post: 04-17-2007, 04:43 PM
  3. PHP fopen question
    By cyberdude3k in forum Programming Discussion
    Replies: 4
    Last Post: 09-24-2006, 06:49 PM
  4. fopen issue in php 5.1.5
    By tdothost in forum Programming Discussion
    Replies: 4
    Last Post: 06-28-2006, 01:02 AM
  5. PHP fopen
    By in forum Programming Discussion
    Replies: 8
    Last Post: 08-27-2002, 08:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts