gpt4 book ai didi

php亚马逊弹性转码器

转载 作者:行者123 更新时间:2023-12-04 13:49:46 24 4
gpt4 key购买 nike

我正在尝试执行一个对视频文件进行转码的工作......我有一个 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 转码器.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

知道为什么它可以从 root 运行以及为什么它不能在浏览器中运行吗?我需要从浏览器访问它。

最佳答案

尝试从 php.ini 更改有关 curl 和 exec 的设置,这就是为什么您无权从浏览器访问脚本,但可以从根控制台访问。

关于php亚马逊弹性转码器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23217626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com