Increasing server memory limit
If you are experiencing memory issues with scripts, it may be necessary to increase the memory available to the script.
If you have access to your servers php.ini file, this is relatively straightforward - simply increase the value of the memory_limit directive to 128M then restart apache. However, I'm guessing that if you're reading this post, looking for a solution to memory issues, then the last sentence probably made little sense, and chances are that you do not have access to your servers php.ini file - this is true for most shared servers.
If you do not have access, all is not lost - you can override the value in either a custom php.ini file, or via the htaccess file - the method needed depends on the following:
If PHP is compiled to run as a cgi script then you will need to use a custom php.ini, but if it is compiled to run as a module then you will need to use htaccess. (tip - you can view your servers php_info() to find out which one)
To set via php.ini file use the following syntax - add this to a file named php.ini and put it in your webroot
memory_limit = 128M
To set via htaccess - add this to your htaccess file
php_value memory_limit 128M
If you wish to set these values within your script - you can also use the ini set method from within php
You can also use the same methods to set other php.ini directives. However, not all directives are available for modification in this manner.
For more info on available directives, see - http://www.php.net/manual/en/ini.list.php