Home > Backend Development > PHP Problem > What should I do if large videos cannot be uploaded using php?

What should I do if large videos cannot be uploaded using php?

爱喝马黛茶的安东尼
Release: 2023-02-25 13:32:02
Original
4184 people have browsed it

What should I do if large videos cannot be uploaded using php?

1. Environment:

CentOS 6.8

nginx 1.8.0

php 7.0.10

2. Background

H5 project based on nginx php. When uploading a video, if the video is too large, the upload will fail.

Related recommendations: "php Getting Started Tutorial"

3. Text

A video is sent to the backend, which requires After two levels:

1, nginx

2, php

Solution=> Modify the configuration item (i.e. the text on the arrow in the picture below):

What should I do if large videos cannot be uploaded using php?

1. Modify nginx configuration

Open nginx.conf and modify:

client_max_body_size 500m;
Copy after login

After restarting nginx, the upload size exceeds 200M video will only report an error:

413 Request Entity Too Large
Copy after login

2. Modify the php configuration

Open php.ini and modify:

upload_max_filesize 500M
post_max_size 550M
memory_limit 600M
Copy after login

Restart php.

Note: Why upload_max_filesize

For a request to upload a file, the following equation exists:

POST DATA = File Base64 form other project data,

HTTP DATA = HTTP HEAD POST DATA.

The file size is limited by upload_max_filesize,

The size of POST DATA is limited by post_max_size,

The entire HTTP request data will be placed in the memory cache first, that is, the size of HTTP DATA is limited by memory_limit limit.

The above is the detailed content of What should I do if large videos cannot be uploaded using php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template