Why does Drupal Page give me a Fatal Memory Error after switching to FastCGI with Apache2?
My site was working fine until I followed this guide, http://www.howtoforge.com/how-to-set-up-apache2-with-mod_fcgid-and-php5-on-ubuntu-9.10 to set up mod_fcgid and php5.
My php.ini in every place has a memory limit of 96MB. The front page of my site (which is Panels / Views) still states, even after flushing cache, and disabling the referenced module:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 122880 bytes) in /var/www/rvr/sites/all/modules/date/date/date.theme on line 146
However, other portions of my site still work, most notable the Drupal Tweaks module, which states my memory limit is 96MB. There are also more memory intensive portions of the site that are still working. I played around with the Boost module before doing the above guide, but its disabled, along with many modules just to try to get this back online.
I have this LAMP setup on a slicehost VPS with 386MB ram, using Ubuntu 10.04.
When I run phpinfo() in the drupal root, it states:
System Linux Rogueroses 2.6.32.12-rscloud #26开发者_StackOverflow SMP Mon May 17 12:35:34 UTC 2010 x86_64
Build Date May 21 2010 06:23:44
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php5/cgi
Loaded Configuration File /etc/php5/cgi/php.ini
Scan this dir for additional .ini files /etc/php5/cgi/conf.d
additional .ini files parsed /etc/php5/cgi/conf.d/apc.ini, /etc/php5/cgi/conf.d/gd.ini, /etc/php5/cgi/conf.d/mcrypt.ini, /etc/php5/cgi/conf.d/mysql.ini, /etc/php5/cgi/conf.d/mysqli.ini, /etc/php5/cgi/conf.d/pdo.ini, /etc/php5/cgi/conf.d/pdo_mysql.ini
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, data, http, ftp, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed
And further down
max_execution_time 30 30
max_file_uploads 50 50
max_input_nesting_level 64 64
max_input_time 60 60
memory_limit 96M 96M
When I'm loading a Drupal page, the top command gives this:
6944 rvr 20 0 185m 42m 31m D 3 11.4 0:01.10 php
2295 mysql 20 0 228m 24m 2128 S 0 6.7 0:57.68 mysqld
96MB is low for a site with panels views and many other modules. You should increase it to maybe 150-200ish. That should give you more room to use advanced memory hungry modules.
While 96MB is rediculous for an average site, it is not unseen when running many modules in Drupal.
However, the error states that it went over 16M, so obviously the value as stated in your phpinfo() is not loaded correctly.
Best place to set values such as memory-limits are in the vhost configuraiton itself. Second best place is the .htaccess Third best place is in settings.php.
I assume you have either a low value (16M) in your settings.php /or/ in .htaccess. Best is to set them in the vhost config and remove them from other places.
You can see the actual values available in Drupal with devel.module, which has a simple php-info() page. Alternatively, you can create a node with PHP-parsing as filter and insert a phpinfo() there. That will show you the actual values as available in Drupal.
精彩评论