【问题标题】:cPanel, CURL and curl_exec to self issuecPanel、CURL 和 curl_exec 到自我问题
【发布时间】:2013-08-15 02:42:11
【问题描述】:

我已将站点从另一台运行 PLEKS 的服务器移至使用 cPanel 的服务器。两台服务器都安装了支持 CURL 的 PHP 5.2.17,但在站点移动到 cPanel 后,站点在 curl_exec 上崩溃到“self”(带有博客 CMS 的网站的一部分)。

该部分的代码如下所示:

                    # INSTANTIATE CURL.
                        $curl = curl_init();

                        # CURL SETTINGS.
                        curl_setopt($curl, CURLOPT_URL, "http://www.mydomain.com/news/index.php?tempskin=_rss2");
                        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 0);

                        # 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;
                        }

                         ?> 

任何线索为什么 cPanel 服务器无法处理?

谢谢

【问题讨论】:

    标签: php curl cpanel


    【解决方案1】:

    在 cPanel 上有两个 php 二进制文件。因此,请通过php -m | grep curl 确认并检查延期。如果它不可用,则必须使用 WHM 中的 EasyApache 选项再次编译 php 以启用 curl。

    【讨论】:

    • 返回Wrong parameter count for curl_error()。有什么线索吗?
    • 另外 EasyApache 配置文件详细信息说:CurlSSL This option will make the following changes to your profile prior to the build: Disables: Curl 也许我需要禁用 CurlSSL 并启用 Curl?
    • curl_error ($curl) - 没有错误消息。您可以查看 www.rosica.com 最新新闻和新闻部分
    • 好的,现在我得到了string(24) "couldn't connect to host",但我可以在浏览器中执行http://www.rosica.com/news/index.php?tempskin=_rss2
    • 我刚从我的浏览器尝试过,它被阻止了。可能是它的防火墙问题。错误:Gateway GEO-IP/BOTNET Alert This request is blocked by the SonicWALL Gateway Geo IP Service. Country Name:India Initiator IP:*.*.*.58(显示整个 ip)
    【解决方案2】:

    在深入研究服务器配置后,防火墙通过创建环回 NAT 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-16
      • 1970-01-01
      • 2012-10-17
      • 1970-01-01
      • 2018-03-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多