There are situations when you have to increase some PHP values, like memory, upload limit, time execution, etc. Most of the web hosting companies, nowadays have decent default PHP values and increases are not necessary, but some WordPress themes might request those values increased a bit.
On the majority of the hosts, you can easily do this via cPanel ➤ PHP INI Settings, or via PHP Selector ➤ Switch to PHP options (In case of ALT-PHP environments) – that’s the easy way; however, I’m pretty sure you have encountered WordPress themes or plugins, that asked you to increase WordPress memory. (wtf is that?!) Not only WordPress memory but WordPress front-end memory and WordPress back-end memory. I know it might sound confusing, but that’s true, those values exist, and here is how you can manage them.
- the first thing you have to do is to take care of the PHP options you can manage via cPanel (as described above or contact your web hosting support department)
- connect to your website via FTP or via File Manager in cPanel and locate the wp-config.php file;
- Edit the wp-config.php file with any text editor and locate the line that says:
/* That's all, stop editing! Happy blogging. */
That’s almost done, the only thing that remains is to add the following two lines, just above that line (very important) add these 2 lines above, not after.
define( 'WP_MEMORY_LIMIT', '512M' ); // increases WP base (front-end) limit define( 'WP_MAX_MEMORY_LIMIT', '512M'); // increases WP admin (back-end) limit
Basically this is how it should look like:
define( 'WP_MEMORY_LIMIT', '512M' ); // increases WP base (front-end) limit define( 'WP_MAX_MEMORY_LIMIT', '512M'); // increases WP admin (back-end) limit /* That's all, stop editing! Happy blogging. */
That’s pretty much it, now you have the WordPress memory increased for both the front-end and the back-end.
Anyway, if you don’t really know what you have to do and your hosting company is not helping you, I’m going to strongly recommending you to switch hosts and chose a better web hosting company – any web hosting company should help you with that.