如何启用在Amazon EC2上自由层卷曲扩展卷曲、自由、Amazon

2023-09-11 09:12:58 作者:残留Dè殇

目前我正在试图使卷曲我的EC2服务器(自由层)上。

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

我已经安装了 php5_curl ,我能够通过PHP通过SSH卷曲运行。

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

testCurl.php

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

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

通过SSH命令: PHP testCurl.php 显示卷曲支持。 当我通过布劳尔访问它的命令显示袅袅不支持。

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.

我已经检查了位于PHP5 / Apache2的的的php.ini 文件(php.ini文件,浏览器加载(通过另一个脚本测试))和扩展没有在那里找到。

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.

我已经检查了位于我的服务器上的extensions_dir的目录和curl.so文件位于那里。

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.

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

干杯, jt234

请注意:如果您需要了解更多信息请咨询。 我的问题是相似的(如果不相同)Unable使用PHP卷曲在Amazon EC2上自由层但问题一直没有得到解决。

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.

推荐答案

在php.ini文件的末尾添加一行:

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

extension=curl.so

如果你想找到它的位置,你可以运行在SSH

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

$ locate curl.so

应该在一些接近:/usr/lib/php5/20090626+lfs/curl.so

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