PHP Upload Issues

Muaz Khan edited this page Jul 15, 2018 · 4 revisions

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.



.htaccess solution

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

php.ini solution

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 /etc/ -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:


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:


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.

After modifying php.ini

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:


// Show all information, defaults to INFO_ALL


Now, open that PHP page and search for all above values e.g. post_max_size etc.

File Permissions

[sudo] chmod 755 ./uploads
[sudo] chown -R www-data:www-data ./uploads
[sudo] chown -R apache:apache ./uploads

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.