PHP memory limit

PHP memory limit

Postby prairiehippo » Fri May 06, 2011 10:13 am

Hi,

I'm trying to figure out why I can't increase the amount of memory available to my PHP scripts beyond 32M. From the information I've searched on this forum, the server should be able to offer 64M (more would be nice, but that should hopefully suffice).

Currently I'm using:
Code: Select all
ini_set('memory_limit', '64M');


This works for all values up to 32M (default), but does not seem to change past the default value. I've tried using a php.ini in my root folder but this results in a fatal error in my application - seems to not load some PHP modules like PDO. Setting the value in the .htaccess file doesn't work either.

Is 32M the limit for shared web hosting? Or might there be something wrong with the server configuration which I should contact support directly about?'

Thanks!
prairiehippo
 
Posts: 2
Joined: Fri May 06, 2011 10:05 am

Re: PHP memory limit

Postby Ray » Tue May 17, 2011 5:07 pm

The default 'memory_limit' value for shared servers is 32 MB by default. But you should be able to raise this limit to some extent either using php.ini file or .htaccess, for your domain (depending upon the PHP server settings).

Similarly you should be able to use the ini_set PHP function to set php variables. If the trouble persists, shoot in a mail to support with all the details (domain, problematic URL, logins, etc) and we shall update you in the reply.
Ray
Ray
 
Posts: 20
Joined: Sun Nov 08, 2009 9:25 pm

Re: PHP memory limit

Postby prairiehippo » Thu May 19, 2011 7:10 am

I followed up with support - apparently the solution is to use a custom php.ini. I was close but was missing the extension lines that I needed. Note, using the .htaccess file did not work in my case - not sure why.

Code: Select all
memory_limit = 64M
extension=pdo.so
extension=pdo_sqlite.so
extension=sqlite.so
extension=gnupg.so
extension=pdo_mysql.so


Thanks!
prairiehippo
 
Posts: 2
Joined: Fri May 06, 2011 10:05 am

Re: PHP memory limit

Postby sean » Fri Jun 03, 2011 11:29 pm

You need to add the directives in custom php.ini file for your domain. Once done change the path of Configuration File to point to the new php.ini in .htaccess
sean
 

Re: PHP memory limit

Postby Hope » Thu Dec 22, 2011 12:30 am

Unfortunately the shared server does not allow increasing the PHP memory limit. We have determined that more than 64 MB taken by a PHP script can endanger the shared server performance and cause overloads.
I recall seeing a recent forum post that detailed a procedure where you didn't need to compile a custom PHP binary, but instead copied the existing binary and ini file from the DreamHost PHP install.
However, we are constantly monitoring applications' needs and realize that this limit might be low for some applications. That's why we plan raising the PHP limits. This will be a process which involves server upgrades and global reconfiguration to preserve the same fast server performance.
Hope
 
Posts: 2
Joined: Tue Dec 20, 2011 2:04 am


Return to PHP

Who is online

Users browsing this forum: No registered users and 0 guests

cron