Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 11-08-2004, 09:19 PM   #1
Registered: Jun 2002
Posts: 411

Rep: Reputation: 30
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] 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
Old 11-09-2004, 01:34 AM   #2
LQ Newbie
Registered: May 2003
Location: The Netherlands
Distribution: LFS
Posts: 28

Rep: Reputation: 15
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:
php_value memory_limit 20M
Old 11-19-2004, 01:41 PM   #3
Registered: Jun 2002
Posts: 411

Original Poster
Rep: Reputation: 30
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.

Last edited by rioguia; 11-19-2004 at 01:45 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is php.ini? Penguin_5333 Linux - Software 8 09-01-2012 08:19 PM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
Upgraded PHP from 4.3.4 to 4.3.10 and now it won't read php.ini gregmcavoy Linux - Software 11 01-22-2005 12:16 PM
php: different mail server from php.ini rayds Programming 0 09-14-2004 03:48 AM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration