How to set PHP.ini value per site – 2MB max file size value

If you have installed some services using PHP where you can upload files (Like Pydio, WordPress, Roundcube, PHPMyAdmin, etc…) you have per default a maximum upload file size of 2 megabytes that could be more than annoying.

This value can be changed directly in your php.ini file but will apply to all PHP services…

If you want to better tweak this per service, like 10MB for Roundcube, 20MB for PHPMyadmin and 1GB for Pydio, I’d suggest you to configure this value directly in the Virtualhost of each of your services on your LAMP server.

You just need to add:

php_value memory_limit 10M
php_value post_max_size 10M
php_value upload_max_filesize 10M

in your virtualhosts (Vhost) after the first <VirtualHost *> and restart/reload apache:

 /etc/init.d/apache2 reload

And voila !

Quite easy that way I believe.



Loves to discover web-based apps to install on his own server@home and write articles about it


Add a comment