Wordpress keeps stating max file upload limit is 2mb. phpinfo() says the same. Using PHP ver 7+
Have tried changing by creating php.ini and .htaccess files in both root and wp-admin directories. Nothing seems to work.
php.ini
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
.htaccess
php_value upload_max_filesize 40M
php_value post_max_size 42M
I think it may help you
A) Theme Functions File
There are cases where we have seen that just by adding the following code in the theme function’s file, you can increase the upload size:
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
B) Create or Edit an existing PHP.INI file
In most cases if you are on a shared host, you will not see a php.ini file in your directory. If you do not see one, then create a file called php.ini and upload it in the root folder. In that file add the following code:
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
C) htaccess
Method
Some people have tried using the htaccess
method where by modifying the .htaccess
file in the root directory, you can increase the maximum upload size in WordPress. Open or create the .htaccess
file in the root folder and add the following code:
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
Make sure that you edited the php.ini file that is referenced in your phpinfo() and that you restart the services using valet restart
afterwards.
Worked for me.
Open a terminal and type
$ php --ini
Configuration File (php.ini) Path: /usr/local/etc/php/7.1
Loaded Configuration File: /usr/local/etc/php/7.1/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.1/conf.d
Additional .ini files parsed: /usr/local/etc/php/7.1/conf.d/ext-geoip.ini,
/usr/local/etc/php/7.1/conf.d/ext-gmp.ini,
/usr/local/etc/php/7.1/conf.d/ext-igbinary.ini,
/usr/local/etc/php/7.1/conf.d/ext-imagick.ini,
/usr/local/etc/php/7.1/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/7.1/conf.d/ext-memcached.ini,
/usr/local/etc/php/7.1/conf.d/ext-opcache.ini,
/usr/local/etc/php/7.1/conf.d/ext-redis.ini,
/usr/local/etc/php/7.1/conf.d/php-memory-limits.ini
Open php-memory-limits.ini like that :
nano /usr/local/etc/php/7.1/conf.d/php-memory-limits.ini
You can now update the file with other value for upload_max_filesize and post_max_size
Save it and valet restart.
I don't if this is your case,
BUT
if you are working with a Wordpress Network (multisite) , be aware that there is a network setting for this in /wp-admin/network/settings.php
I spent an hour on this *%#@£%!