-
Notifications
You must be signed in to change notification settings - Fork 1.8k
PHP Upload Issues
This wiki page explains how to modify
php.ini
file or.htaccess
file to support large-size uploads in PHP applications. Such issues usually happens when you try to record 2-3 minutes of audio/video streams and resulting Blobs size gets bigger/larger than 10MB.
References:
- https://github.com/muaz-khan/WebRTC-Experiment/issues/224#issuecomment-46087136
- https://github.com/muaz-khan/WebRTC-Experiment/issues/281
It is a common case among all PHP default installations. You should define following values in .htaccess
file if you've root-level privileges.
<IfModule mod_php4.c>
php_value session.gc_maxlifetime 10800
php_value max_input_time 10800
php_value max_execution_time 10800
php_value upload_max_filesize 500M
php_value post_max_size 500M
</IfModule>
Above technique rarely works on Amazon EC2. You need to login as root-user to the terminal; then search for all php.ini
files:
find / -name "php.ini"
There should be php.ini
file located in your appache installation directory. Its location varies for each installation that's why you should check all php.ini
files.
vim php.ini
// or otherwise you can use "vi"
vi php.ini
Above command will open editing mode; then you should search and edit following values:
/session.gc_maxlifetime
/max_input_time
/max_execution_time
/upload_max_filesize
/post_max_size
Each line is searching a specific string. Note: Above command may work in replace
mode instead of insert
mode.
You should change default values to:
session.gc_maxlifetime=10800
max_input_time=10800
max_execution_time=10800
upload_max_filesize=500M
post_max_size=500M
Remember, NEVER forget "max_execution_time" because usually ffmpeg execution process takes time to transcode and merge webm.
:wq
command can be used to save changes and close editing mode. You need to type this command in "replace" mode.
Note: You can navigate between insert
and replace
modes by simply pressing insert
key.
You MUST restart/reboot appache server to make sure new changes are applied.
Please don't forget to set a temporary PHP page where you can check PHP-info:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?>
Now, open that PHP page and search for all above values e.g. post_max_size
etc.
=
P.S. Sometimes you need to manually set read/write access for directories like "uploads" however your demo has privileges to read/write WAV/WebM files in uploads directory.