LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   php.ini / .htaccess memory issues (https://www.linuxquestions.org/questions/linux-software-2/php-ini-htaccess-memory-issues-252634/)

rioguia 11-08-2004 09:19 PM

php.ini / .htaccess memory issues
 
i have a program that runs once when my website loads (randomphoto block in a nuked gallery 1.43a). it requires more than the standard 8 mb memory set in /etc/php.ini. (e.g. memory_limit 32M). Since php.ini governs any php script, i am concerned that just increasing the limit for the entire server could cause stability problems. I need to know if there are alternatives for setting the memory limit, especially in a .htaccess file.

Iwould like to allow this increased memery consumption for this one program or one website.

I have seen suggestions that the memory limit can be set as part of the virtual host configuration:

php_admin_value memory_limit 20M

I have heard that php parameters can be set in .htaccess files but have not seen an example of this for memory.

logged error message

[client 192.168.0.44] PHP Fatal error: Allowed memory size of 12582912 bytes exhausted (tried to allocate 32 bytes) in /var/www/html/modules/gallery/classes/Album.php on line 783

Pecunia 11-09-2004 01:34 AM

According to the PHP manual, memory_limit is only available if PHP has been compiled with the --enable-memory-limit flag. It can be set everywhere, which includes httpd.conf and .htaccess. For those two files, use something like this:
Code:

php_value memory_limit 20M

rioguia 11-19-2004 01:41 PM

fine tune memory on a per script basis using PHP_INI_ALL
 
Thanks for your help. Your solution worked. The PhP Manual provides pointers on how to fine tune memory on a per script basis using PHP_INI_ALL.


All times are GMT -5. The time now is 11:12 PM.