简体   繁体   English

PHP的cURL问题

[英]cURL issue with php

When i am tryin to manualy fetch a php page by passing URL, an exception is appearing which says 当我尝试通过传递URL手动获取php页面时,出现了一个异常,该异常表示

javax.servlet.ServletException: java.lang.RuntimeException: PHP Fatal error: Uncaught exception 'Exception' with message 'Facebook needs the CURL PHP extension. javax.servlet.ServletException:java.lang.RuntimeException:PHP致命错误:消息为“ Facebook”的未捕获异常“ Exception”需要CURL PHP扩展名。

but when I searched php curl in my insatllation directory, I found it there. 但是,当我在insatllation目录中搜索php curl时,我在那里找到了它。

[ashish@hpproliant ~]$ which php
/usr/local/bin/php
[ashish@hpproliant ~]$ which curl
/usr/local/bin/curl

I have modified php.ini file where a line related to curl was commented..What do i need do do now?? 我已经修改了php.ini文件,其中注释了与curl相关的一行。.我现在需要做什么? Thanks 谢谢

也许

sudo apt-get install php5-curl

Just follow the below steps, and check have you done exactly same as below:- 只需按照以下步骤操作,并检查是否完全符合以下条件:

sudo apt-get install php5-curl

Make sure curl is enabled in the php.ini file (for me it's in /etc/php5/apache2/php.ini), if you can't find this line, it might be in /etc/php5/conf.d/curl.ini. 确保在php.ini文件中启用了curl(对我来说,它在/etc/php5/apache2/php.ini中),如果找不到此行,则可能在/etc/php5/conf.d/中。 curl.ini。 Make sure the line : 确保行:

extension=curl.so

is not commented out then restart apache, so type this into putty: 没有被注释掉,然后重新启动apache,因此在腻子中输入以下内容:

sudo /etc/init.d/apache2 restart

Debug:- Check whether curl is enable in PHP or not:- 调试:-检查是否在PHP中启用curl:-

Method 1: 方法1:

function curlEnabled() {
    if (ini_get('safe_mode') == 1)
        return 0;

    return in_array('curl', get_loaded_extensions());
}

Method 2: 方法2:

function_exists('curl_init');

and please print the php_info(); 并请打印php_info(); of your server and post it here. 您的服务器并在此处发布。

Please Refer to the below links Too:- Detect if cURL works? 请也参考以下链接:- 检测cURL是否有效? PHP CURL Enable Linux PHP CURL启用Linux

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM