简体   繁体   中英

Keep getting error 500, php file_get_contents

I keep getting error 500 when trying to get a very large file with php,

$get_file = file_get_contents("../../test/test.mp4", true); // the size of .mp4 is more than 2GB
echo $get_file;

Anyone knows what I'm doing wrong here?

My php.ini file isset to handle 4000 MB, (I'm not sure if php even can handle that much)..

Thanks.

From PHP manual :

Note: string can be as large as up to 2GB (2147483647 bytes maximum)

And since file_get_contents returns a string... ;)

Instead, use fopen to retrieve a file pointer resource and fread to read data portionally.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM