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.

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

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功