Is it possible to configure php upload_max_filesize by .htaccess file? Since I do not have access to the php.ini file from the server.
Is it possible to configure php upload_max_filesize by .htaccess file? Since I do not have access to the php.ini file from the server.
To complement the other answer, to use configuring php through .htaccess, you must have mod_php
installed on your server, if your server or hosting does not have availability, an error message will appear on all error pages 500 Internal Error Server , similar to this:
Ifyourhosting/serverallowsyoutoinstallthingsperterminal(ssh)youcantrysomethinglike(beingDebianorUbuntu):
sudoapt-getinstalllibapache2-mod-php5
Notethatyouwillneedtorestarttheserver,howeverifyoudonothaveaccesstoSSHthenyouwillhavetocontactsupporttoenable.
Seethedifferencesinmod_phpsettings:
php_flagisusedwhenthereareBooleanvalues,whichsettingsofphp.inithatonlyaccept1or0,OnorOffandtrueorfalse,forexample:
php_flagdisplay_startup_errorsoffphp_flagdisplay_errorsoff
php_valueisusedwhenitisnotaboutturningonoroff(likeOnandOff),inthecaseweusewecanusetodefinepathsandlimitsinmegabytes,
php_valueupload_max_filesize25Mphp_valueerror_log/foo/bar/baz/erros.log
php_admin_flagcannotbeusedin.htaccess,youcanonlyconfigureitinApacheandthisallowsyoutooverwritewhichphp.iniconfiguration,differentfrompreviousonesthathaslimitations.>
php.ini
anddonothavemod_php
buttheyhavetheoptionofeditingafileonthelocaluserthatoverwritessomeflags You can use the ini_set()
function in PHP! Just put the contents of the .ini line as a parameter:
<?php
ini_set("upload_max_filesize", "10000");
Doc: link