Memory allocation server problems, have to re-save php.ini everytime..?

6 posts / 0 new
Last post
#1 Sat, 09/12/2015 - 02:56
marceld202

Memory allocation server problems, have to re-save php.ini everytime..?

Hi,

I have a couple of websites on a VPS. I use virtualmin / webmin as adminpanel. Since a couple of days, the sites are getting a white screen. Or, one Magento shop does not show images.

I checked logs and the images problem and found out that there was a memory allocation issue. The server has 2gb ram memory and it never gets above 1,5gb usage. Most of the time it stays under the 1GB.

I checked php.ini configuratie (virtualmin > services > php5 configuration) and there is a setting 'memory_limit'. I changed that to 512 to try, and saved the config. Then I reloaded the website and everything worked fine.

However, 2 hours later, the sites were not working again. So I checked again, but the setting was still 512M. Then I re-saved the settings and reloaded the website, and again everything was working.

Last but not least, I even tried setting the ram to 128M, just to try and everything worked after saving. But like 2 hours later, it wasn`t working anymore.

I know this storie might sound very strange.. I have no idea how to fix this. Any idea what`s going on, what might be causing this issue?

Many thanks in advance!

Sun, 09/13/2015 - 17:21
Diabolico
Diabolico's picture

Ok just to make one thing clear, Magento out of the box is crap. If you think you can just install Magento and use it for hundreds or even thousands products you are wrong. Before you start playing around with the server are you sure Magento is working properly? It could be that Magento is eating up all memory, have spikes in memory usage or is eating good part of 2GB memory and then other server functions push over the limit.

For Magento i would start with at least 512MB "memory_limit" and if not enough go up but not more than 1GB (this really depends on what you have there). Second thing you want to play around is "max_execution_time". To be clear, you can "push" Magento to work even on shared hosting but is asking a lot of tweaking and stripping down everything what is not used (still some limitation can apply).

My advice is if you are not 100% sure Magento is working good i would hire a Magento developer and let him setup everything. To be sure the person is not a scam and pretend to be certified Magento developer check his details here: https://www.magentocommerce.com/certification/directory. If you dont have thousands of products go for something easier to manage and with less hardware requirements (woocommerce, opencart, prestashop, zencart... all opensource and good alternatives).

Or... increase memory to something bigger but if Magento doesnt work properly it will not last for too long.

- I often come to the conclusion that my brain has too many tabs open. -
Failing at desktop publishing & graphic design since 1994.

Mon, 09/21/2015 - 13:27
marceld202

Hi,

Thanks for your extensive reply.

I already assumed Magento was a memory eater :) I was on a shared host last year and they just couldn`t get it functioning properly without me paying lots of money for extensive server resources. Since then I do a couple of optimizations for every Magento store to have it consume less memory, but it is still heavy as it seams.

However, my problems seems to be fixed (for now). My latest change is I added php value memory limit 512M to htacecss files of all sites on the VPS, since those changes I haven`t had any problem.

Could it be that the Virtualmin setting is not honored? Since I also set 512M in Virtualmin. I`m still not sure what took down the server, must have been some script eating up all memory which is now prevented with the memory limit. At least, that would be my best guess.

I think the server setup and Magento install is pretty solid. I make use of backend caching mechanism and I have optimized the Magento installation to consume less memory by disabling all kind of modules, optimizing logging, etc.

For now it`s working and lets hope it stays that way ;)

Thanks again for your help!

Mon, 09/21/2015 - 13:30
marceld202

BTW: I have tried alternative CMS, but still Magento is our customers favorite. I myself use Woocommerce on my store and I love the user experience in frontend plus it asks much less server resources. However, I do miss some features here and we have had lots of customers requesting specific features which just were not supported by other CMSs but where by Magento.

Mon, 09/21/2015 - 14:09
andreychek

Could it be that the Virtualmin setting is not honored? Since I also set 512M in Virtualmin. I`m still not sure what took down the server, must have been some script eating up all memory which is now prevented with the memory limit. At least, that would be my best guess.

If your PHP execution mode is set to FCGID or CGI, then PHP would (or at least, should) use $HOME/etc/php.ini file all PHP related settings.

If it's set to mod_php, then it would use the system-wide php.ini file in /etc.

You can determine which setting your domain is using by looking in Server Configuration -> Website Options, and there, verify the value of "PHP Execution Mode".

-Eric

Mon, 09/28/2015 - 08:28
marceld202

Hi Eric,

Thanks for the explanation. Everything seems to work ok now, all my sites are set to mod_php so good to know I will have to change the /etc/php.ini file for default values.

For now I added the php_value exception which seems to be working good.

Thanks again!

Topic locked