【发布时间】:2019-10-03 19:14:27
【问题描述】:
当我尝试上传超过 10mb 的视频时,服务器显示错误 502 我也更改了 php.ini 文件,phpinfo 也反映了更改
post_max_size 40M
upload_max_filesize 35M
max_execution_time 1200
max_input_time
<?php
error_reporting(E_ALL);
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
?>
<!DOCTYPE html>
<html>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</body>
</html>
【问题讨论】:
-
你确定是文件大小的问题吗?可能你的请求太长了(比 Nginx 超时时间长)
-
不,当我上传 5mb 的视频时,它在上传 10mb 时工作正常,它的节目“当前无法处理此请求。HTTP 错误 502”,我正在使用“amzn2-ami-hvm”服务器
标签: php amazon-ec2