{"id":113,"date":"2015-05-14T21:49:02","date_gmt":"2015-05-14T20:49:02","guid":{"rendered":"http:\/\/www.herbiez.com\/?p=113"},"modified":"2015-05-15T00:19:48","modified_gmt":"2015-05-14T23:19:48","slug":"allowed-memory-size-of-xxx-in-security-onion-maybe-fixed","status":"publish","type":"post","link":"https:\/\/www.herbiez.com\/?p=113","title":{"rendered":"Allowed memory size of &#8216;XXX&#8217; error in Security Onion &#8211; Fixed!"},"content":{"rendered":"<p style=\"text-align: center\"><a href=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2015\/05\/php-memory.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-119\" src=\"http:\/\/www.herbiez.com\/wp-content\/uploads\/2015\/05\/php-memory.png\" alt=\"php-memory\" width=\"400\" height=\"300\" \/><\/a><\/p>\n<p>So off and on while playing with Security Onion and Squert over the past several months, I have come across the dreaded &#8220;PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in \/var\/www\/squert\/.inc\/callback.php&#8221; error when pulling up a full PCAP in either ELSA or Squert. Looking around at different posts via the <a href=\"http:\/\/groups.google.com\/forum\/#!topic\/security-onion\" target=\"_blank\">SO group on Google<\/a> and on Google itself, I could never &#8220;fix&#8221; the issue. Most of the time the answer was to do the following:<\/p>\n<blockquote><p>You&#8217;ll need to increase the memory_limit setting in php.ini and restart Apache.<\/p><\/blockquote>\n<p><!--more--><\/p>\n<p>My loaded PHP file is found at &#8220;\/etc\/php5\/cli\/php.ini.&#8221; The default for Security Onion for this setting is the &#8220;-1&#8221; which by PHP standards means consume as much as you want (got to love excess). But even with this set to &#8220;-1&#8221;, and &#8220;max_execution_time&#8221; set to &#8220;300&#8221; I would sometimes not be able to read the PCAP. So tonight after changing tact, and looking more at posts dealing with PHP, I stumbled across a post talking about not only changing the &#8220;\/etc\/php5\/cli\/php.ini&#8221; file, but also the &#8220;\/etc\/php5\/apache2\/php.ini.&#8221; Once I did that, the same alerts that caused the error messages from OSSEC where no more and I could see the full PCAP!<\/p>\n<p>Just make sure that you change the memory_limit to something like &#8220;memory_limit = <em><strong>1024M<\/strong><\/em>&#8221; and <strong>NOT <\/strong>&#8220;memory_limit = <em><strong>1024MB<\/strong><\/em>&#8221; as that will cause issues when trying to run simple commands with PHP (ie: <a href=\"http:\/\/stackoverflow.com\/questions\/4696915\/php-help-results-in-php-memory-exhausted-error-on-ubuntu\" target=\"_blank\">php -i)<\/a> as you can see below:<\/p>\n<blockquote><p>PHP Fatal error:\u00a0 Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0<\/p><\/blockquote>\n<p>Happy monitoring!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So off and on while playing with Security Onion and Squert over the past several months, I have come across the dreaded &#8220;PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate Y bytes) in \/var\/www\/squert\/.inc\/callback.php&#8221; error when pulling up a full PCAP in either ELSA or Squert. Looking around at different posts via the SO group on Google and on Google itself, I could never &#8220;fix&#8221; the issue. Most of the time the answer was to do the following: You&#8217;ll need to increase the memory_limit setting in php.ini and restart Apache.<\/p>\n<p> <a class=\"continue-reading-link\" href=\"https:\/\/www.herbiez.com\/?p=113\"><span>Continue reading<\/span><i class=\"crycon-right-dir\"><\/i><\/a> <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-113","post","type-post","status-publish","format-standard","hentry","category-security-onion"],"_links":{"self":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=113"}],"version-history":[{"count":6,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/113\/revisions"}],"predecessor-version":[{"id":121,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=\/wp\/v2\/posts\/113\/revisions\/121"}],"wp:attachment":[{"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.herbiez.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}