Have you ever installed a Joomla extension and got nothing but a white screen?
Most likely you hit the memory limit on your server. Memory limits help to keep scripts from running out of control or using up all of your free memory. On the other hand, sometimes you are adding a fancy extension to your site, that simply requires slightly more memory then the default 8mb that Apache gives you. Let’s show you how to fix that.
First, before we get too far, these instructions assume your server is running Apache and you either are on a VPS, or a dedicated server. If you are on a shared host, this might still be possible, but it is dependent upon how your host has your account setup. It may or may not be easy to change. If you are unsure, submit a ticket to your webhost. You are paying for their service, there is nothing wrong with asking them.
Now, let’s get rolling. You will want to be able to see what your memory limit is easily. If you are on Joomla, you can login to the backend and go to:
Help>System Info>Php Information
Search the page for “memory_limit”. You will see something similar to this. (yours will possibly say 8m)
Now that we know what our php memory limit is, let’s get to changing it.
Many guides for changing your memory limit on the internet are written for people with a dedicated server and presume you want your entire server, and all it’s enclosed websites to have a higher memory limit. This is less then ideal, but I will explain who to do it anyhow.
Edit your php.ini file.
Open your php.ini file. YMMV, but it will most likely be located at:
Search for memory_limit and change the value from 8m, to 16mb or 32mb. (don’t go much higher)
Save the file, then restart Apache via ssh using this commend or whatever method you prefer.
Check your phpinfo now, and you should be fixed.
Now, if you have more then one website on your server you most likely do not want to raise your memory limit globally. You would want to do it on a per-site basis. To do it this way, you will make a change in your websites public_html directory. This is called a override.
Not all webhosting companies are the same. There are two ways you can do this.
A: .htaccess override.
Open up, (or create) a file in your public_html directory called .htaccess. Inside this file, add the line
php_value memory_limit 16M
Save it, and check your phpinfo again. No restart is required for this.
B: php.ini method
If .htaccess didn’t work, some webhosts will have you put a file called php.ini in your public_html directory instead. Inside that file, insert the line:
memory_limit = 16M
Save it, and check your phpinfo again.
Use one or the other of these methods. Typically one of these methods will make your site 500 error if your webhost does not allow it. Make sure you check your site after every change you make. If your site 500’s, then your host does not permit the method you tried, and revert your changes.
There. Now you have raised your php memory limit to be able to handle heavier scripts. You can usually get by with 8mb for Joomla, but with new extensions like WordPress4Joomla and JoomlaJunkies Morph, you will most likely need 16mb. the minimum requirement for Drupal is 16mb, with 32mb recommended. Just do not go much over 128mb. Typically 32 will be more then enough.
What do you keep your memory limit at on your site? Let us know your thoughts in the comments.