After installing WordPress, you may want to change the default theme and install a new one, install some WordPress plugins, create new posts and upload image files etc. When installing a WordPress theme, plugin or uploading an image using the WordPress back-end, you may receive the following error message in your web browser:
‘The uploaded file exceeds the upload_max_filesize directive in php.ini’
There is no need to panic, because the solution of this problem is quick and easy.
There are four simple ways you can fix this problem:
- Edit the .htaccess file located in the document root directory of the WordPress installation.
Locate the .htaccess file, and edit it using your favorite editor (vi,nano,vim etc.), and add or modify the following line:php_value upload_max_filesize 100M
Replace ‘100’ with the maximum upload file size (in megabytes) that you want to set on your WordPress installation.You may also want to adjust some other PHP settings, like:
– memory_limit (maximum amount of memory a script may consume);
– post_max_size (the maximum size for all POST body data);
– max_execution_time (the maximum time in seconds a script is allowed to run before it is terminated by the parser);
– max_input_time (the maximum time in seconds a script is allowed to parse input data, like POST and GET).
If so, add or modify the following lines too:php_value memory_limit 256M php_value post_max_size 32M php_value max_execution_time 600 php_value max_input_time 900
Get optimized, fully managed WordPress hosting from us and we’ll configure and fix your WordPress for free - Edit the ‘functions.php’ file located in the active theme directory (wp-content/themes/), or the ‘wp-config.php’ file located in the document root directory of the WordPress installation.
Add the following line to the wp-config.php file:@ini_set( 'upload_max_size' , '100M' );
- Edit the main PHP configuration file.
Use the following command to locate the main PHP configuration file on your server, e.g.:# php -i | grep -i php.ini Configuration File (php.ini) Path => /etc/php/7.0/cli Loaded Configuration File => /etc/php/7.0/cli/php.ini
Once you locate the main PHP configuration file, edit it and add or modify the following line:upload_max_filesize = 100M
It is a good idea to modify these settings too:memory_limit = 256M post_max_size = 32M file_uploads = On max_execution_time = 600 max_input_time = 900
Do not forget to restart your web server for the changes to take effect. - Create a local php.ini configuration file in the document root of the WordPress installation, ‘add upload_max_filesize = 100M’ to it, save the file thus override main php.ini configuration settings.
Again, you need to restart your web server for the changes to take effect.
That is it. You should be able to install new WordPress theme, plugins, and upload image files now.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to change the upload_max_filesize PHP setting for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons below or simply leave a comment in the comments section. Thanks.
Không có nhận xét nào:
Đăng nhận xét