Increase file size limit for my Wordpress site?
Hi there,
I am trying to upload a plugin to my Wordpress site and it says that the file is too big. It says that my hosting size limit is 2MB and I need to have that changed through php.ini
I am not sure how to access that since there isn't a CPanel.
Can someone help me out?
3 Replies
Create a file called (for example) php-info.php and put this in it:
Save it in your site's public HTML directory.
Make it executable (I use chmod in terminal but there are other ways.)
Run it: https://your-domain-name.com/php-info.php
The 6th and 7th line from the top will be where and what php.ini you are using (I use FPM):
Configuration File (php.ini) Path /etc/php/8.0/fpm
Loaded Configuration File /etc/php/8.0/fpm/php.ini
Go to that php.ini file and at the very end of the file add these lines:
max_execution_time = 180
max_input_time = 180
memory_limit = 256M
post_max_size = 50M
upload_max_filesize = 50M
I think you have to restart FPM and maybe Apache and that will depend on what OS you are running.
(If using Apache you can do this via the directory's .htaccess file but using the .ini file is global and better.)
Create a file called (for example) php-info.php and put this in it:
You left out the contents:
<?php
phpinfo();
?>
Make it executable (I use chmod in terminal but there are other ways.)
This is completely unnecessary…and, IMHO, inadvisable.
PHP files are interpreted…not executed… Consequently, it's only the interpreter that needs to be executable. The file being interpreted only needs to be readable (and writable depending on your needs).
In the case of PHP, the interpreters are:
- mod_php (the apache2 module);
- php-fpm (the fast CGI daemon);
- /usr/bin/php (the CLI program…wherever it is you installed it).
-- sw