php亚马逊弹性代码转换器

问题描述 投票:1回答:2

我正在尝试执行将对视频文件进行代码转换的工作...我有一个php文件:

<?php
require 'vendor/autoload.php';

use Aws\ElasticTranscoder\ElasticTranscoderClient;

// Create a service locator using a configuration file
$client = ElasticTranscoderClient::factory(array(
        'key'    => 'my key',
        'secret' => 'my secret',
        'region' => 'us-west-2',
));

$result = $client->createJob(array(
        'PipelineId' => 'my pipeline id',
        'Input' => array(
                'Key' => 'video.mp4',
                'FrameRate' => 'auto',
                'Resolution' => 'auto',
                'AspectRatio' => 'auto', 
                'Interlaced' => 'auto',
                'Container' => 'auto',
        ),
        'Output' => array(
                'Key' => 'output.mp4',
                'ThumbnailPattern' => 'thumb{count}.jpg',
                'Rotate' => 'auto',
                'PresetId' => '1351620000001-000010',
        ),
));

?>

而且我将此脚本称为transcoder.php

事实是,如果我从VPS的根目录像php transcoder.php一样调用它,它就可以正常工作,但是如果我尝试从浏览器(Safari,Chrome,Firefox)调用它,我会得到一个] >

Fatal error: Uncaught exception 'Aws\ElasticTranscoder\Exception\ElasticTranscoderException' in /home/my_user/public_html/test/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php:91 

Stack trace: 

#0 /home/my_user/public_html/test/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php(76): Aws\Common\Exception\NamespaceExceptionFactory->createException('Aws\ElasticTran...', Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response), Array) 

#1 /home/my_user/public_html/test/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/ExceptionListener.php(55): Aws\Common\Exception\NamespaceExceptionFactory->fromResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response)) 

#2 [internal function]: Aws\Common\Exception\ExceptionListener->onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher)) 

#3 /home/my_user/public_html/test/vendor/symfony/event-dispatcher/Symfony/Component/Even in /home/my_user/public_html/test/transcoder.php on line 35

有人知道为什么它可以从根本上运行,为什么它不能从浏览器上运行?我需要从浏览器访问它。

我正在尝试执行将对视频文件进行转码的工作...我有一个php文件:

php amazon-web-services amazon amazon-elasticache amazon-elastic-transcoder
2个回答
1
投票

尝试从php.ini中更改有关curl和exec的设置,这就是为什么您没有权限从浏览器访问脚本,但可以从root控制台运行的原因。


0
投票

首先,在代码周围放一个try/catch statement,以查看整个错误消息,这将有助于诊断问题。

© www.soinside.com 2019 - 2024. All rights reserved.