0

I have Magento CE 1.9.2.0, my var/report and var/session files has become so big I am unable to open them. My server crashes each time I try to open.

How do I set Cron to delete old files that are not necessary for both folders. I have got got php.ini in my root folder, below is the information.

; This file is for CGI/FastCGI installations.
; Try copying it to php5.ini, if it doesn't work

; adjust memory limit

memory_limit = 64M

max_execution_time = 18000

; disable magic quotes for php request vars

magic_quotes_gpc = off

; disable automatic session start
; before autoload was initialized

flag session.auto_start = off

; enable resulting html compression

zlib.output_compression = on

; disable user agent verification to not break multiple image upload

suhosin.session.cryptua = off

; turn off compatibility with PHP4 when dealing with objects

zend.ze1_compatibility_mode = off

; PHP for some reason ignores this setting in system php.ini 
; and disables mcrypt if this line is missing in local php.ini

extension=mcrypt.so

; Disable PHP errors, notices and warnings output in production mode to prevent exposing sensitive information.

display_errors = Off
php_value memory_limit 128M

Any advice will be much appreciated.

0

Yes, left unchecked, log files can grow and take up the balance of your entire hard drive, and crash your site. (We've seen this happen quite a bit in the past.)

There's two things you should do:

  1. Set a cookie lifetime for sessions, so that they will expire after 5 days or 30 days, and people won't be able to keep things in their cart forever.

  2. Use Magento's built in system for cleaning out logs. You can get to it from here: System --> Configuration --> Advanced --> System > Log:

Here's a screenshot of it: Log Cleaning in Magento

Please note that Magento cron will need to be running for this to work (but a lot of other stuff won't work if Magento cron is not set, including transactional emails).

Or, you could use the guide here: https://www.crucialhosting.com/knowledgebase/magento-log-cache-maintenance

... that will show you how to do this outside of Magento.

I hope this helps!

  • My cookies lifetime is set to 36000 and the setting in System --> Configuration --> Advanced --> System > Log is set to save logs for 14days and log cleaning is on and set to daily but I believe I can add a cron job on my server as well by following crucialhosting.com/knowledgebase/magento-log-cache-maintenance. Thank you – Tank Feb 27 '17 at 15:36
  • You're welcome! :) – Jeff Finkelstein Feb 27 '17 at 15:51
  • I am still unable to open or view "var/report" and "var/session" folders on my server. I believe because there are over a million files in the folders. Any advice how I will be able to reduce the size so I can view the folders, especially the report folder for diagnosing my store. Thanks – Tank Mar 1 '17 at 23:52
  • You'll probably need to use an SSH command to remove those directories. rm -r /report/ will do it. But be extremely careful - there is no undo button. If you don't feel comfortable with doing this, have someone that can. For the session folder, if you remove the folder, that's fine - just know that if that's what you're using to handle sessions - everyone will lose the contents of their cart. – Jeff Finkelstein Mar 2 '17 at 15:50
  • Thanks Jeff, Is there anyway I can delete some of the files in the folder like old and outdated files so I can easily access the file? – Tank Mar 9 '17 at 23:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.