icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Allowed memory size exhausted

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old July 3rd, 2008, 11:35 AM   #1 (permalink)
Registered User
Seasoned Poster
 
Joined in May 2003
Lives in Atlanta, GA
68 posts
Gave thanks: 0
Thanked 0 times
Unhappy Allowed memory size exhausted

I'm getting this error:
"Allowed memory size of XXXX bytes exhausted (tried to allocate 4000 bytes)"

I'm on a shared hosting server - so I don't have direct access to php.ini.

I tried the .htaccess method:
php_value memory_limit 32000000
which gave me a Server Error 500...

I also tried init_set() from the PHP file at the top:
ini_set(”memory_limit”,”32M”);
Which seemed to make no difference (same error)

How do I get around this memory issue?
__________________
Server:
simplemedia.com
XX.XX.74.115 (Reseller)
DNS:
ns770.dizinc.com
ns771.dizinc.com
Sites:
www.simplemedia.com
www.southernbloom.com
www.torimoto.net
www.rubyforest.net
takabanana is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 3rd, 2008, 3:09 PM   #2 (permalink)
Race Surpass
Super #1
 
MarkRH's Avatar
 
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,218 posts
Gave thanks: 18
Thanked 86 times
If PHP is configured correctly, you can use a local PHP.INI file to over-ride values. Just create in the directory where the script is:

Code:
[php]
memory_limit = 64M      ; Maximum amount of memory a script may consume (8MB)
You might even submit a ticket to support concerning this to see if they can put in a copy of the server's PHP.INI in your local directory with the above modification.. or just change the value for the server itself.
MarkRH is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 3rd, 2008, 11:12 PM   #3 (permalink)
Registered User
Comfy Contributor
 
snakeyez.us's Avatar
 
Joined in Jan 2006
Lives in Mississippi
Hosted on SH142
102 posts
Gave thanks: 12
Thanked 4 times
Grab this file:

http://surmunity.com/images/thephp5!/php.ini

and put it into the directory where your php script is.

Read here if you like.
__________________
LanceDean.com | Blalock.LanceDean.com | DeanForestryServices.com | sNaKeYeZ.us | SUBMARINEMUSEUMS.ORG
all on SH142 [66.7.205.59]
snakeyez.us is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks snakeyez.us for this great post!
Lifestar (July 6th, 2008)
Old July 6th, 2008, 8:50 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
Joined in Jan 2006
3 posts
Gave thanks: 1
Thanked 0 times
Son of a *%^$#. I have been having tons of problems with my sites the last few days login in as admin getting all sorts of errors. I started messing with stuff to the point it was completely broke. Decided to blow my Gallery away and re-install and still had weird problems. put that php.ini file in and things worked. Would have been nice if Surpass would have let us know this instead of sending an email saying everything will be fine after their upgrade.
Lifestar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 7th, 2008, 3:11 PM   #5 (permalink)
Registered User
Seasoned Poster
 
Joined in May 2003
Lives in Atlanta, GA
68 posts
Gave thanks: 0
Thanked 0 times
Quote:
Originally Posted by snakeyez.us View Post
Grab this file:

http://surmunity.com/images/thephp5!/php.ini

and put it into the directory where your php script is.

Read here if you like.
That worked - is there a recommended max memory limit?
Also - This only seems to work with the PHP files in that directory, but not subdirectories? Is this correct?
Also also (wic wic) - Any suggested methods to figure out how much memory a PHP script is using up?
__________________
Server:
simplemedia.com
XX.XX.74.115 (Reseller)
DNS:
ns770.dizinc.com
ns771.dizinc.com
Sites:
www.simplemedia.com
www.southernbloom.com
www.torimoto.net
www.rubyforest.net
takabanana is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old July 8th, 2008, 12:46 AM   #6 (permalink)
Race Surpass
Super #1
 
MarkRH's Avatar
 
Joined in Jul 2006
Lives in Oklahoma City, OK
Hosted on sh102
1,218 posts
Gave thanks: 18
Thanked 86 times
Check this out: PHP: memory_get_usage - Manual

I haven't tried using it.

Not sure if it's a server-wide setting or a per account setting, but the PHP.INI file in my public_html directory affects all the php scripts in that folder and below. My add-on and sub-domains have their own PHP.INI files in their root-folders.
MarkRH is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On