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 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型