Have you run big wordpress site and suddenly find out there is something not working after your wordpress site become bigger? I do, and sometimes I was thinking to use other CMS because there is no better solution for this case. Out of memory problem can only be solved by raising the memory_limit, The problem is how if I’m still using shared hosting?

Actually this case already happen to me long time ago. When my site with worpdress CMS become bigger I notice wp-db.php error in hosting logs. Mostly all errors coming from out of memory. I have not found the real solution for this problem the only way is raising the memory_limit in php.ini file.

Raising memory_limit in php.ini file is not smart solution, Said the standard shared hosting only allowed you to use memory_limit 64MB (some only 32MB) if you change the memory_limit in single php.ini files with new higher memory_limit you hosting provider may suspended your account! Why? because all your php script will run using that single php.ini memory_limit.

[to_plus]

Yesterday I was searching on google and found the smart solution for this case. I said smart because we will only allow some php files which may need more memory to run. It will not affect other php files and just run with memory_limit sometimes when you executed it. Your hosting account will be safe and your php script can run as usual without error.

How to do this trick? Just put this small code inside your php files which needed more memory to run.

ini_set(“memory_limit”,”128M”);

Put this code inside your php code before php tag closed. Your php files which you added this code will run with memory limit 128MB. You can change 128 value with memory your script may consume example 256. But remember don’t over do it or you may have problem with your hosting provider 😀

This trick can be applied also on other php script with same error message out of memory. Just add that code inside your php files and it will works like a charm.

That’s my share for today, have a nice day everyone 🙂

[/to_plus]

Similar Posts:

Related Search Terms:

    Digg Del.icio.us StumbleUpon Reddit Twitter RSS

If you're new here, you may want to subscribe to my RSS feed. You may copy or publish this article to your blog or other site as long you give credit link back to this site article. Thanks for visiting my blog!