Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

cPanel, CURL and curl_exec to self issue

Discussion in 'General Discussion' started by InteractM, Aug 13, 2013.

  1. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hi,

    I have moved site from another server running PLEKS to the server with cPanel. Both servers have installed PHP 5.2.17 with CURL support but after site move to cPanel site is crashing on curl_exec to "self" (part of the web site with blog CMS).

    Code for that part looks like:

    PHP:
                                # INSTANTIATE CURL.
                                
    $curl curl_init();

                                
    # CURL SETTINGS.
                                
    curl_setopt($curlCURLOPT_URL"http://www.mydomain.com/news/index.php?tempskin=_rss2");
                                
    curl_setopt($curlCURLOPT_RETURNTRANSFER1);
                                
    curl_setopt($curlCURLOPT_CONNECTTIMEOUT0);

                                
    # GRAB THE XML FILE.
                                
    $xmlData curl_exec($curl);

                                
    curl_close($curl);

                                
    # SET UP XML OBJECT.
                                
    $xmlObjData simplexml_load_string$xmlData );

                                
    $tempCounter 0;

                                foreach ( 
    $xmlObjData->channel->item as $item )
                                {                    
                                    
    # DISPLAY ONLY 10 ITEMS.
                                    
    if ( $tempCounter 10 )
                                    {
                                        echo 
    "<li><a href=\"{$item -> link}\">{$item -> title}</a></li>
                                "
    ;
                                    }

                                    
    $tempCounter += 1;
                                }

                                 
    ?>    
    Any clue why cPanel server can't handle that?

    PS.
    EasyApache profile details returns that:

    Thanks
     
    #1 InteractM, Aug 13, 2013
    Last edited: Aug 13, 2013
  2. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Well, it looks like cPanel is blocking CURL connection to "self". curl_error returns

    Any clue?
     
  3. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
  4. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    Are you using ModSecurity?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Nope. Should I?
     
  6. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    I meant that ModSecurity might block those requests.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Is this a specific PHP application that you are using, or is it a custom-developed script?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    It is custom developed but simple pull for XML. As far wget is making connection failure it is not a script issue, because http://www.mydomain.com/news/index.php?tempskin=_rss2 is available through the browser.

    Also when I will do cURL connection to google.com (or something not on my cPanel installation) I'm able to execute cURL.
     
  9. InteractM

    InteractM Well-Known Member

    Joined:
    Apr 2, 2013
    Messages:
    135
    Likes Received:
    1
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    After digging through server configuration as well firewall got it solved with creating a loopback NAT.
     
  10. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,895
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    I am happy to hear you were able to resolve the issue. Thank you for sharing the solution with us.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice