CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Fatal error: Out of memory error while creating PDF Print of only 24 newletters
Pages: [1]

Author Topic: Fatal error: Out of memory error while creating PDF Print of only 24 newletters  (Read 6177 times)

nca4bh

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.0.8
  • CMS version: Joomla 1.7.3
  • MySQL version: 5.1.56
  • PHP version: 11.30.5.6
Fatal error: Out of memory error while creating PDF Print of only 24 newletters
January 24, 2012, 11:24:07 am
I am trying to print out 24 Newsletters (for those contacts that do not want email distro). It is a 2-page newsletter, fairly packed with text. I had to reformat previously because I was using lots of DIV/TABLES... So it is pretty simply formatting, just lots of text.

I can print a single contact easily.
I can print 10 easily
But when I get to about 18, it errors out, and any value above 18 it errors with the following:

Fatal error: Out of memory (allocated 67371008) (tried to allocate 46 bytes) in /home/nca4bh/public_html/ncasite_j17/administrator/components/com_civicrm/civicrm/packages/dompdf/include/frame_factory.cls.php on line 199

I have read several posts here, and tried several things below, nothing changes the error message, that seems to indicate that it is running out of memory after 64MB, but the settings are for more than that, so it doesnt appear CiviCRM recognized the fixes I've tried below:

1) I have worked with my hosting provider. We have changed the php.ini file in the public_html (root) directory to the following:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 60
max_input_time = 60
memory_limit = 256M


2) Upon suggestion of the hosting provider tech, I copied that php.ini to the administrator/components/com_civicrm/civicrm/packages/dompdf/include/ directory

3) I tried to add the following  ini_set('memory_limit', '300M'); to the civicrm/CRM/Utils/PDF/Utils.php file suggested in topic=10511.0

4) checked the file administrator/components/com_civicrm/civicrm.settings.php file and it seemed like my setting are higher than what I am erroring at:
if ($memLimit >= 0 and $memLimit < 134217728) {
    ini_set('memory_limit', '128M');
}


Anyone know of any fix short of printing 10 at a time?

Thanks in advance, Chris.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
January 25, 2012, 08:46:19 am
Can you confirm what your memory limit really is via php_info() ?
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

nca4bh

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.0.8
  • CMS version: Joomla 1.7.3
  • MySQL version: 5.1.56
  • PHP version: 11.30.5.6
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
February 05, 2012, 11:09:39 am
I am using HostGator, and their system settings for my domain are:

Language Options                                asp_tags                   Allow ASP-style <% %> tags.                             Off
File Uploads                                             file_uploads           Whether to allow HTTP file uploads.             On
Paths and Directories                          include_path           Windows: "\path1;\path2"                                     .:/usr/lib/php:/usr/local/lib/php
Resource Limits                                     max_execution_time                                                                                30
Resource Limits                                     max_input_time                                                                                        60
Resource Limits                                     memory_limit                                                                                        256M
Data Handling                                     register_globals                                                                                    On
Language Options                             safe_mode                                                                                               Off
main                                                     session.save_path                                                                              /tmp
File Uploads                                           upload_max_filesize  Maximum allowed size for uploaded files.   64M

clarkac

  • Administrator
  • Ask me questions
  • *****
  • Posts: 399
  • Karma: 11
  • CiviCRM version: 4.4.11 & 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.27
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
May 03, 2012, 08:12:54 am
I too have this problem, my limit is around 25 PDF letters and yet my installation has a generous limit of 256mb (from phpinfo).  It would appear that the PDF process just eats more memory the more contacts are processed, which I understand but is impractical in this context!   Is this recorded as something that needs to be fixed?
Andy Clark

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
May 03, 2012, 08:18:59 am
Quote from: clarkac on May 03, 2012, 08:12:54 am
Is this recorded as something that needs to be fixed?

This issue has certainly come up a few times in the forums, so the team is aware of it.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
May 03, 2012, 09:55:33 am

unfortunately the open source world has not solved the pdf issue very well :(

however 4.2 includes integration with wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/

which hopefully is a lot faster and better than what we currently use. However it does require wkhtmltopdf to be installed on your server

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

clarkac

  • Administrator
  • Ask me questions
  • *****
  • Posts: 399
  • Karma: 11
  • CiviCRM version: 4.4.11 & 4.5.5
  • CMS version: Drupal 7
  • MySQL version: 5.1.61-cll
  • PHP version: 5.3.27
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
May 04, 2012, 08:02:31 am
Update on this, for what it's worth...  My (UK) hosting provider upped my memory limit to 512mb; it then failed on max_execution_time which was 60 secs.  So they increased that limit to 180 secs.  Result - if I try printing 40 PDF letters I get a 'page not found' which I guess is some kind of error message that can't be located.

Conclusion:  I'll tell my users to do no more than 25 letters at a time, and wait for 4.2  :-\

BTW, my hosting company is vidahost.com - I've found them very helpful and definitely Civi friendly.
Andy Clark

dittofluid

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.19
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Fatal error: Out of memory error while creating PDF Print of only 24 newletters
February 09, 2013, 02:32:36 pm
I just ran into the "out of memory" problem and was glad to find the wkhtmltopdf workaround here. However I had to add a step.  Maybe this will be useful to others:

I'm running CiviCRM 4.2 on an Ubuntu 10.04 without X11, so I had to also install the X-emulator xvfb. 

Code: [Select]
apt-get install wkhtmltopdf
apt-get install xvfb

I prefer not to use a runlevel-script to start xvfb so I created a trivial shell script containing:
Code: [Select]
#!/bin/csh
# Execute wkhtmltopdf inside an emulated
#  X-server
xvfb-run --auto-servernum /usr/bin/wkhtmltopdf $*

I entered the path to this script at
Administrator > System Settings > Undelete, Logging & ReCAPTCHA > Path to wkhtmltopdf executable


I tested this to generate letters to 300 contacts, which quickly produced a 300 page PDF with no problems.




Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Fatal error: Out of memory error while creating PDF Print of only 24 newletters

This forum was archived on 2017-11-26.