NYCPHP Meetup

NYPHP.org

[joomla] FW: fatal error: allowed memory size

Sasa Rakic rakics at neobee.net
Mon Feb 6 14:52:15 EST 2012


Hi there,

 

In most cases memory limit is reached when classes and code from database

Allocated to many memory. This can be increased by changing php.ini file,

If php.ini is not available, setting can be changed from PHP code, example:

 

php.ini

max_execution_time = 30

max_input_time = 60; Maximum amount of time each script may spend parsing
request data

;max_input_nesting_level = 64 ; Maximum input variable nesting level

memory_limit = 128M                    ; Maximum amount of memory a script
may consume (128MB)

 

; Maximum size of POST data that PHP will accept.

post_max_size = 128M

 

; Maximum allowed size for uploaded files.

upload_max_filesize = 256M

 

PHP code:

 

  ini_set("display_errors","1");

  ini_set("error_reporting",E_ALL);

 

  ini_set("memory_limit", "128M");

  ini_set("post_max_size", "128M");

  ini_set("upload_max_filesize", "128M");

 

In most of my projects I am adding Custom error handler, attached.

It will be good to copy/paste in index.php file. It shows error

In browser like:

 

Error occurred in php file
 at line
.error message is
.

 

And it also saves error into /_errors.log.txt so you can over FTP see

Error that occurred when visitors has browsed site and date and time of
error.

 

      $backtrace = debug_backtrace();

 

In attached code is used to show error in browser like this:

 

Error occurred in:



.Filename.class.php at line 78



.Previous Filename.class.php at line 178



.Previous 2nd Filename.class.php at line 88

etc


 

So you will know what scripts/functions/classes has consumed memory.

 

Best regards,

Sasa

 

From: joomla-bounces at lists.nyphp.org [mailto:joomla-bounces at lists.nyphp.org]
On Behalf Of Scott Wolpow
Sent: Saturday, February 04, 2012 4:00 AM
To: NYPHP at lists.nyphp.org; SIG at lists.nyphp.org:Joomla
Subject: Re: [joomla] fatal error: allowed memory size

 

Thanks, feeling better already.
When you save the change in Cpanel, it restarts the service.
HostGator, GoDaddy and many others do not publish their real conflagrations.
Even when you do a php info page.


We have been playing with Varnish to speed up the sites and when there is a
need, we will write a 'pressflow' like system for Joomla.
It may be a Joomla Fork. It will depend on what direction a project goes in.
I got tired of other peoples machines so I now have my own NOC in Tarrytown.
Our hosting is by invite only.
SW

On 2/3/2012 9:50 PM, David Roth wrote: 

Feel better and very soon, Scott! 

 

I've not run into a problem with memory issues on MySQL, thanks for
explaining it. Something to certainly watch out for. The most daring change
I've made to my.cnf file is to move the MySQL databases to an eSATA RAID.

 

On shared hosting services, like Hostgator, you can copy the /etc/php.ini
locally to your account and  make whatever changes you need to make Joomla
happy for installation and increase the memory limit. You can also use
.htaccess to override those things as well. In the CPANEL there are
additional options for PHP. The server on Hostgator doesn't need to be
re-started for them to take effect. I forget what configuration of PHP they
are using to achieve this. I know on my own CentOS server, I do have to
restart httpd. I think it has to do with some option on PHP at compile time
(of PHP itself) if you want things to take immediate effect or not.

 

Shared hosting can have its limits, and often times you don't know what they
might even be until you start doing production. There is usually a work
around but sometimes the limits aren't even documented.

 

David Roth

 

On Fri, Feb 3, 2012 at 9:21 PM, Scott Wolpow <scott at wolpow.com> wrote:

It is a php.ini issue, sorry have a bad cold.


There is a similar error involving MySql.
It comes from a search that has too many queries or joins.
The MBString can cause that sometimes.

Since you are on a shared platform, you must call support.

The Apache server has to be restarted to take effect.

On a dedicated server or VPS it is a simple service httpd restart
In your environment you may have something in your cPanel.
 
This is why shared is baaad.

SW
On 2/3/2012 9:01 PM, David Roth wrote: 

Scott, I must be missing something. How do you know this error message could
be database related and not just PHP? 

 

"Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to
allocate 6859888 bytes) in
/home/swarrez/public_html/sw173/libraries/phputf8/mbstring/core.php on line
121"

 

David Roth

 

 

 

On Fri, Feb 3, 2012 at 5:03 PM, Scott Wolpow <scott at wolpow.com> wrote:

Yes, for php mem limits, but that error can also be caused and cured by
changing the my.cnf file.
The mem limit is from the DB.

SW

On 2/3/2012 4:49 PM, Chris French wrote: 

You can also set the Memory limit inside of a php script, but the better
place to do it is in the php.ini file as Donna pointed out.  

 

ini_set('memory_limit', '64M');

 

should in most servers give you the increase in memory this can be good for
testing

 

Chris

On Feb 3, 2012, at 11:44 AM, Donna Marie Vincent wrote:

 

That's not "configuration.php".  That's the php configuration, which is
php.ini.  Has nothing to do with Joomla or MySQL

 

"configuration.php" is a file in the Joomla installation.

 

  _____  

From: Helvécio da Silva <helvecio.rj at gmail.com>
To: NYPHP SIG: Joomla <joomla at lists.nyphp.org> 
Sent: Friday, February 3, 2012 4:41 PM
Subject: Re: [joomla] fatal error: allowed memory size

 

I dont know wether it's a MySQL issue or Joomla issue. 

What I can say is when that happened to me I made the change in
configuration.php and things started working fine.

Check this post in the Joomla forum. Hope it helps.

http://forum.joomla.org/viewtopic.php?f=32
<http://forum.joomla.org/viewtopic.php?f=32&t=246541&p=1129624&hilit=increas
e+memory+limit#p1129457>
&t=246541&p=1129624&hilit=increase+memory+limit#p1129457

2012/2/3 Scott Wolpow <scott at wolpow.com>

It is a MySql issue, not a Joomla issue.
Not sure if the Joomla user has the rights.

SW 



On 2/3/2012 4:09 PM, David Roth wrote: 

I handle memory limit increases for PHP in the php.ini file. Am I missing
something by it being cone in the configuration.php file? Thanks! 

 

David Roth

 

On Fri, Feb 3, 2012 at 4:03 PM, Helvécio da Silva <helvecio.rj at gmail.com>
wrote:

In your configuration.php file, write on the very first line

ini_mem('memory_limit','12M');

If it doesn't work, try to increase it.

G'luck!

2012/1/31 paul elliott <peforever at hotmail.com>

Hello, 

I made a copy of my default template and assigned it to a menu item for
Hikashop categories.

At some point, after i go into the Template Manager, i now cannot get in to
edit either template.

I get this:

 

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to
allocate 6859888 bytes) in
/home/swarrez/public_html/sw173/libraries/phputf8/mbstring/core.php on line
121

 

Please help!

Thanks,

Paul

 

 

_______________________________________________
New York PHP SIG: Joomla! Mailing List
http://lists.nyphp.org/mailman/listinfo/joomla
 
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
 
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php


_______________________________________________
New York PHP SIG: Joomla! Mailing List
http://lists.nyphp.org/mailman/listinfo/joomla

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

 

 

_______________________________________________
New York PHP SIG: Joomla! Mailing List
http://lists.nyphp.org/mailman/listinfo/joomla
 
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
 
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/joomla/attachments/20120206/1bf644c0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setting.php
Type: application/octet-stream
Size: 5250 bytes
Desc: not available
URL: <http://lists.nyphp.org/pipermail/joomla/attachments/20120206/1bf644c0/attachment.obj>


More information about the Joomla mailing list