douren4075 2017-01-31 07:27
浏览 20
已采纳

aws php sdk - 函数在本地主机和控制台上运行,但在服务器上不在浏览器上运行

I'm having an issue where my php function works when I call it from the server's command line, but not on the web page. It also works on the web page when I have it hosted locally through WAMP.

Any ideas what might be the issue?

function getCFTemplateSummary($CFUrl){
//init client
$client = new CloudFormationClient(array(
    'profile' => 'default',
    'region' => 'us-east-1',
    'version' => '2010-05-15',
    'http' => [ 'verify' => false ]
    ));

    try {
    $result = $client->getTemplateSummary(['TemplateURL' => $CFUrl]);
    }catch(\Aws\CloudFormation\Exception\CloudFormationException $e){
        echo $e->getMessage();
    }catch(\Aws\Exception\AwsException $e){
        echo $e->getMessage();
    }

    echo "<pre>";
    print_r($result);
    echo "inside the function";
    echo "</pre>";
    return $result;

 }

I was able to trace down the issue to this by trial and error commenting ...but not sure how to proceed debugging as I don't see any error messages.

$result = $client->getTemplateSummary(['TemplateURL' => $CFUrl]);
  • 写回答

1条回答 默认 最新

  • duannao3402 2017-01-31 16:32
    关注

    Try catching Exception instead of \Aws\CloudFormation\CloudFormationException, it's possible that a different Exception (e.g., incorrectly configured AWS credentials) is being thrown from your server that you aren't explicitly catching in your current code.

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

报告相同问题?

悬赏问题

  • ¥15 公司的电脑,win10系统自带远程协助,访问家里个人电脑,提示出现内部错误,各种常规的设置都已经尝试,感觉公司对此功能进行了限制(我们是集团公司)
  • ¥15 救!ENVI5.6深度学习初始化模型报错怎么办?
  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。