I have installed a WordPress instance on GKE but cannot upload a new theme for my site, because the max upload size is set to 2MB.
The best answer depends on details not present in your question. For example, which operation system? How is PHP configured? Which version? That determines which php.ini file to modify.
This example is for Ubuntu PHP version 7.4 FPM:
Edit /etc/php/7.4/fpm/php.ini
Change upload_max_filesize = 2M (change to desired limit)
Change post_max_size = 8M (change to desired limit)
Change memory_limit = 128M (usually not necessary to change)
restart the server.
In the worst case, you can just modify all of the php.ini files located in the /etc/php subdirectories. Make sure you back up each file that you modify.
Note: you have tagged Kubernetes, which means you must modify the containers while being built and not after deployment.
I just exported a Wordpress homepage bigger than 2mb. Is there a simple method to import it again. I would even pay money for this very simple plugin.
WordPress have a native Import plugin. On your admin dashboard go to:
Tools > Import and under WordPress click the Install Now link.
This will install the WordPress Importer for free.
See here:
https://wordpress.org/support/article/importing-content/#wordpress
EDIT (OP CLARIFIED THAT THE PROBLEM WAS THE LARGE FILE SIZE OF THE XML EXPORT):
If a WordPress WXR file, an XML file exported from WordPress, is too large to import, there are several things you might try to overcome that limit.
1. Edit php.ini (Some hosts may not allow this settings):
memory_limit = 300M
post_max_size = 200M
upload_max_filesize = 100M
max_execution_time = 600
memory_limit: Maximum amount of memory in bytes that a PHP script is allowed to allocate.
Note: memory_limit should be larger than post_max_size, and post_max_size must be larger than upload_max_filesize.
2. Edit .htaccess (Some hosts may not allow this settings):
php_value memory_limit 300M
php_value post_max_size 200M
php_value upload_max_filesize 100M
3. Edit wp-config.php
define('WP_MEMORY_LIMIT', '64MB');
See also Increasing memory allocated to PHP.
4. Increase the file upload size limit and/or file upload space limit:
Login to wp-admin as an administrator.
In the Site Admin navigation box, click "Options"
Scroll down and change the settings for "Max upload file size" and/or "Blog upload space"
5. GZip the file:
On some hosting services, a gzipped file can be automatically expanded in the background, without WordPress ever knowing the difference. This can allow you to make the file small enough to be fit into the maximum upload size constraints.
On Windows, use 7Zip to create a gz archive out of the wxr file.
On Linux, use the gzip command line.
Make sure that the resulting file has the file extension of ".gz" before uploading it, as this is often necessary.
If this fails, then try another method instead:
6. Break the WordPress WXR file into smaller pieces by separating the data between posts and pasting the header/footer into each file:
6a. Always have the header
<rss version="2.0"
xmlns:excerpt="https://wordpress.org/export/1.2/excerpt/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:wp="https://wordpress.org/export/1.2/"
>
<channel>
including all info like category, tags, etc to just before the first
6b. Always have the footer
</channel>
</rss>
6c. In between, add the posts start with end with and check to see whether the XML file you’re creating is less than or equal to 2MB. You’ll get the hang of it.
6d. As always, before importing the new XML’s, backup the database of the blog you are importing the XML files to and might as well export XML file of that blog as well for good measure.
7. Try WXR Splitter Utilities:
http://www.rangerpretzel.com/content/view/20/1/ (Windows)
https://suhastech.com/wordpress-wxr-xmlfile-splitter-for-mac-os-x/ (Mac)
8. If you got here:
It might be easier to just use the WP Migrate DB Pro (paid) plugin (https://deliciousbrains.com/wp-migrate-db-pro/). Despite the name, with an add-on it also imports media files.
More Information can be found on the WordPress documentation:
https://wordpress.org/support/article/faq-working-with-wordpress/#how-do-i-import-a-wordpress-wxr-file-when-it-says-it-is-too-large-to-import
I'm trying to learn wordpress by creating an e-commerce website every time I load the web page I get the following error:
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 30720 bytes) in /public_html/wp-content/plugins/wp-e-commerce/wpsc-widgets/category_widget.php on line 61
So far I have tried the following:
putting this at the top of the wp-config.php file
define('WP_MEMORY_LIMIT', '64M');
and putting this at the top of the .htaccess file
php_value memory_limit 64M
I can't even access wp-login.php page as it throws the same error.
When the admin is inaccessible, the first step is to connect via FTP and rename the folder wp-content/plugins to plugins-old and try to connect.
It will probably work. Then rename the folder back and go enabling the plugins one by one until you find the culprit. If not, do the same with the themes folder.
Useful info:
Troubleshooting Master List
Similar posts at WordPress Answers
>
I am getting this error despite of trying every possible solution provided on internet. Whenever i try to install a plugin i get this error again and again
This is what i have already done :-
I changed the upload_max_filesize in php.ini present in apache2 folder to 30M and pasted it in wp-admin directory
Secondly i created a .htaccess file in wp-admin directory and pasted some code I found on the internet.
Even after all this i am getting this error . Please help me out.
Its mean you are uploading the file which is bigger than your upload_max_filesize in php ini
Locate the php.ini file in the folder your upload script resides in.
In the php.ini file, locate the line called 'upload_max_filesize =
2M'. Modify that entry to read
'upload_max_filesize = 10M', or whatever your script requires. (M =
megabytes)
First of all you need to verify that the php.ini that you are modifying is actually affecting the php that is running on apache (usually php runs as an apache module) so, what you need to do is change the upload_max_filesize directive and then run a php script with the phpinfo() function and check that it actually is taking the change, if it isn't check in that page where it says the php.ini script is running and verify it's the same file you're modifying.
There are circumstances where there are different php.ini files, even files that aren't even named as php.ini but that are loading the configuration of php, so it is important for you to figure out which file is actually relevant to the apache module, also you will find the need to check for this when you run php from the command line.
I had the same problem, I tried several solutions and none worked until I edited the php.ini file in /etc/php5/apache2/php.ini and not in /etc/php5/cli/php.ini as everyone said.
Just change these lines, save and restart your Apache:
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 180
max_input_time = 180
memory_limit = 256M
I want to increase max execution time on my wordpress site. I know I should edit php.ini, but can't seem to find it!
any tips?
I see this question so much! everywhere I look lacks the real answer.
The php.ini should be in the wp-admin directory, if it isn't just create it and then define whats needed, by default it should contain.
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
Okay. Answer for self hosted wordpress installations - you'll have to find the file yourself. For my WordPres site I use nginx with php7.3-fpm.
Running php -i | grep ini from console gives me several lines including:
Loaded Configuration File => /etc/php/7.3/cli/php.ini. This is ini configuration when running php command from command line, a.k.a. cli.
Then looking around I see there is also a file: /etc/php/7.3/fpm/php.ini I use FPM service so that is it! I edit it and THEN reload the service to apply my changes using: service php7.3-fpm reload.
That was it. Now I can upload bigger files to my WordPress. Good luck
Wordpress dont have a php.ini file.
It just a cms, look into your server.
for example if you use XAMPP in windows xampp\php\php.ini is the location.
I used this, very cool tool
https://wordpress.org/plugins/php-settings/
This plugin provides a simple user interface with a code editor to edit your local .ini settings.
This can be used to change settings like
upload_max_filesize or max_execution_time
which are often set to very low values by the hosting companies.
Open .htaccess file in a code editor like sublime text and then add..
php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value memory_limit 3000M
php_value max_execution_time 1800
php_value max_input_time 180
hope it helps..............it did for me.
Use the php_ini_loaded_file function to get the location of your php.ini file.
<?php
$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}
A php.ini file is not installed by default with Wordpress. You may have one already installed by your web host. Look in your root directory or ask your web host or read your web host's documentation on how to install one.
Look for max_execution_time in your php.ini file and change to 60 or 90
If you have access to our webroot, create a file asdf.php with
<?php phpinfo(); ?>
in it and point your webbrowser to it. You should see all info in the first section.
Configuration File (php.ini) Path
Loaded Configuration File
Scan this dir for additional .ini files
Additional .ini files parsed
This works for any php application and is therefore the universal way to find our php.ini
This Worked For Me. I have installed wordpress in godaddy shared server. Open .htaccess file using editor and add the following from the first line,
# BEGIN Increases Max Upload Size
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 300
php_value max_input_time 300
# END Increases Max Upload Size
This solved the php.ini issues for me in the server.
I just came across this thread while searching for an answer to why the php.ini file would be within the /wp-admin/ folder for WordPress that I have just seen in an odd setup - because it really really shouldn't be there.
WordPress by default doesn't include a php.ini file within the /wp-admin/ folder, so you should not have one there yourself. The php.ini file is designed to override the main server PHP configuration settings so that your account on the server is treated differently, within limits. As such, if you do need to use this file, please, for your own sanity (and that of others who happen to work with your systems in the future...), place the php.ini file in the root of your account, not hidden away in the /wp-admin/ folder, or any other folder for that matter.
I'm surprised to see so many others commenting that it should be in the /wp-admin/ folder to be honest. I'd love to see some official documentation from WordPress stating that this is best practice, as this is certainly something that I would completely avoid.
Create a file yourself php.ini anywhere in your root or wp-admin folder and add the necessary code to the file it should work
If your hosting provider is using Plesk, go to Websites & Domains > PHP settings from where you can seamlessly change memory_limit, max_execution_time, max_input_time, etc. Hope it helps.
If you use cPanel and have installed CloudLinux you can go to section Software > Select PHP Version > Switch To PHP Options and define max_execution_time among other options.
Short gif: http://cloud.mercadoalvo.com/nDdE
you can do it from the Cpanel:
1.- CPANEL
2.- Select PHP Version
3.- Swich to PHP options
4.- Edit:
max_execution_time 1800
max_input_time 64
max_input_vars 6000
memory_limit 512M
post_max_size 128M
upload_max_filesize 128M
The name of the custom ini file depends on the user_ini.filename php setting. By default this should be .user.ini and the custom configuration files are used on a per-directory basis, so you should be able to either put it in the root of your Wordpress installation or under the wp-admin folder.
You can check the name of your custom configuration file by running:
php -i | grep user_ini.filename
I have created a plugin which makes it possible to change php settings from the Wordpress administration:
Custom PHP Settings
The plugin makes it possible to change settings either using the .htaccess file or the custom php.ini file, depending on how php is running.
I am adding an answer based on my experience and also thanks to Michael Cropper and Salman von Abbas for their inputs.
The php.ini file is created when php is installed on the server. I believe that wordpress installation requires php to be installed on the server. So your webhost typically installs it on their server and then sells you the hosting space. Then you install your wordpress on it.
Hence, it follows clearly from this that the php.ini file will not be present in the wp-admin folder.
So you need to look for it either at your root folder (but most likely it won't be there if you're on a shared webhosting plan). Then you need to create a file as such:
create a new file in the location = /public_html/your_domain/any_name.php
Put the following code inside the file:
<?php
$inipath = php_ini_loaded_file();
if ($inipath) {
echo 'Loaded php.ini: ' . $inipath;
} else {
echo 'A php.ini file is not loaded';
}
Now try to access the file through your browser as follows:
https://your_domain/any_name.php
This should show a message that clearly states the location of your php.ini file.
If you're on a shared hosting plan then you probably won't have access to this folder. You will need to inform the web hosting support to take care of this for you.
Hope this helps!
use this in your htaccess in your server
php_value upload_max_filesize 1000M
php_value post_max_size 2000M