Memory Allocation Error - Create php.ini for PHP 5.3

 

Some programs produce errors in which it says the memory allocation is limited to 32MB and that you've exceeded the maximum allotted memory.

By default on the server the maximum amount of memory allocated to each file is 32MB. This helps stop the server from running away with a script and locking up (crashing) the server.

If you require more allocation, the error code will tell you how much more it needs - usually it's only a few killobytes, however you'll want to round this number up to the nearest megabyte. Here's an example error (truncated of course to eliminate customer details)

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3840 bytes) in ...

While the error sounds like it had 32MB (33554432 bytes = 32MB) allocated and only tried to use a few bytes, it actualy means that it tried to use MORE than the 32MB allocated. In this case, it tried to use 3840 bytes more.

So if the number listed is lower than 1,048,576, just add one megabyte. Between 1,048,576 and 2,097,152 would be two megabytes and so on.

You can create a custom php.ini file within your site and upload it to the folder where you have installed your script. In the file place the following line:

memory_limit=35M

This will increase the memory limit from 32MB to 35MB. If you require more, increase the size. Please do not increase it to some large number such as 50MB or 200MB as this only defeats the purpose of trying to keep your site online without crashing.

All SHARED Hosting customers are limited to a maximum execution of between 110MB and 120MB. This is a system limit. If you have any questions regarding the memory limits or regarding a custom php.ini file, or require more than 100MB of memory allocation for the script to run, please open a support ticket at http://billing.handsonwebhosting.com for further assistance.

Also, please note that if you were using ionCube, you will need to add it's lines back into your new php.ini.

If your scripts require IonCube or PDO_SQL, we recommend not only adding the additional memory setting, but also inserting the commands for Zend, IonCube and PDO_SQL too so that they work;

 

memory_limit = 35M


[Zend]
zend_extension="/usr/local/IonCube/ioncube_loader_lin_5.3.so"
zend_extension_ts="/usr/local/IonCube/ioncube_loader_lin_5.3_ts.so"
extension=pdo.so
;extension=pdo_sqlite.so
extension=sqlite.so
extension=pdo_mysql.so

 

  • Email, SSL
  • 5 Users Found This Useful
Was this answer helpful?

Related Articles

How do I install IonCube with a custom php.ini file?

If you create a custom php.ini file, you lose access to ioncube. Litecommerce and x-cart both...

Memory Allocation Error. Create a custom php.ini for PHP 5.2

Some programs produce errors in which it says the memory allocation is limited to 32MB and that...

How to install X-Cart

So you want to install X-cart. We think x-cart is a great choice; its highly customizable and...

Is there a limit to the number of emails (mailing lists and newsletters) that X-cart can send?

There are limits on the emails. We have a server imposed limit of a maximum of 400 emails sent...

Is my x-cart license actually mine? What if I choose to host elsewhere?

Yes. The software is 100% yours. If you choose to move to an alternate host, just be sure to...