duankang5882 2012-09-05 04:05
浏览 83
已采纳

如何在Amazon EC2免费套餐上启用cURL扩展

I am currently trying to enable cURL on my EC2 server (free tier).

I have installed php5_curl and I am able to run curl through php via SSH.

I am using the following file to see whether cURL has been installed correctly.

testCurl.php

<?php
    function _iscurlsupported() {
            if (in_array ('curl', get_loaded_extensions())) {
                return true;
            }
            else {
                return false;
            }
    }

    if (_iscurlsupported()) {
            echo "cURL is supported
";
    }
    else {
            echo "cURL isn't supported
";
    }
?>

The command via ssh: php testCurl.php displays that curl is supported. The command when I access it through a brower displays that curl ISN'T supported.

I have checked the php.ini file located in php5/apache2 (the php.ini file that the browser loads (tested through another script)) and the extension is no where to be found.

I have checked the "extensions_dir" directory located on my server and the curl.so file is located there.

I am unsure why I am unable to run curl when accessing my script via the browser.

Any help would be greatly appreciated.

Cheers, jt234

Note: If you require any more information please ask. My problem is similar (if not the same as) Unable to use PHP curl on amazon ec2 free tier but the issue hasn't been resolved.

  • 写回答

1条回答 默认 最新

  • douxian6086 2012-09-07 23:30
    关注

    In the end of your php.ini file add the line:

    extension=curl.so
    

    if you want to find where it is located you can run over SSH:

    $ locate curl.so
    

    it should be in something close to: /usr/lib/php5/20090626+lfs/curl.so

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作