The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php open stream problem

Discussion in 'General Discussion' started by Haloweb, Jan 20, 2005.

  1. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Hi there

    I really hope somone can help with this,
    I am having a probelm with my box not being able to connect with
    another box if i run the following code
    <?php
    $f = file( "http://google.com" );
    $f = implode( '', $f );
    ?>

    I get

    Warning: file(http://google.com): failed to open stream: Connection timed out

    I can connect via wget

    and have recompiled php via various means, fopen is operational and everything
    seems to be 100%

    does anyone have any ideas?
     
  2. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    Did you make sure you have allow_url_fopen enabled? Check your php.ini file.
     
  3. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    mmm thats strange,

    I dont see it in my
    /usr/local/Zend/etc/php.ini

    I thought it was part of the buildapache config

    ok , please could you tell my how to get it in there
     
  4. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    You must still have an outdated php.ini, the allow_url_fopen option was added quite a few versions ago.
    I suggest you use the php.ini file that comes with php 4.3.10, but make sure you're using the same settings as in your current php.ini (register_globals, magic_quotes and so on)

    Set allow_url_fopen to on like this:
    allow_url_fopen = On

    Here is a segment of my php.ini file:
    Code:
    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ;upload_tmp_dir =
    
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 2M
    
    
    ;;;;;;;;;;;;;;;;;;
    ; Fopen wrappers ;
    ;;;;;;;;;;;;;;;;;;
    
    ; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
    [B]allow_url_fopen = Off[/B]
    
    ; Define the anonymous ftp password (your email address)
    ;from="john@doe.com"
    
    ; Define the user agent for php to send
    ;user_agent="PHP"
    
     
  5. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    thanks james,

    I will give it a try :)
     
  6. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    well it does not seem to be working,

    and i really need to beat this thing,
    any other suggestions james
     
  7. jamesbond

    jamesbond Well-Known Member

    Joined:
    Oct 9, 2002
    Messages:
    738
    Likes Received:
    1
    Trophy Points:
    18
    Did you try it with other url's? Perhaps the request is being blocked?
    Or maybe firewall rules on your server are blocking it?
     
  8. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    yip i have tried without any luck, I dont have a firewall in yet
    and have check with my DC so that cant be the problem

    I have tried installing whoiscart as my billing system, which needs
    to communicate with the whoiscart.net server for the license
     
  9. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    your server is blocking port 80 requests outward. You will need to check the iptables for the block. that is where it shld be blocking.
     
  10. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    could the following have anything to do with the problem i am having

    Warning: User directive in <VirtualHost> requires SUEXEC wrapper
     
  11. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    no as far as i know. could u try:

    iptables -F

    and then access the pages.
     
  12. Haloweb

    Haloweb Well-Known Member

    Joined:
    Jul 2, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    wow iptables -F worked

    thanks, can i buy you a beer :)

    really thanks allot for your help guys
     
  13. linux-image

    linux-image Well-Known Member

    Joined:
    Jun 8, 2004
    Messages:
    1,192
    Likes Received:
    1
    Trophy Points:
    38
    Location:
    India
    cPanel Access Level:
    Root Administrator
    hmm.. FedEx me a beer. ;)
     
Loading...

Share This Page