Internal Server Error generated when ran on PHP 5.2.8

323 views
Skip to first unread message

Justin

unread,
Jul 7, 2010, 10:05:01 AM7/7/10
to dompdf, carlb...@mobetter.com
Any help would be greatly appreciated! I tested dompdf on my
localhost, which is running 5.2.5 and everything has worked fine.
When I published to my production server, however, I get an Internal
Server Error. Here is the complete message:

---

Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, sup...@supportwebsite.com
and inform them of the time the error occurred, and anything you might
have done that may have caused the error.

More information about this error may be available in the server error
log.

---

I've read that people have had this issue with php 5.2.8, and by
upgrading to 5.2.9 it fixed the error. However, I'm running on
GoDaddy Shared Hosting, and I do not know how to upgrade my php
version to 5.2.9. GoDaddy only allows me to change to 4.x or 5.x.
I've heard a little something about php yum update but I don't really
understand all that command line stuff that it requires. Is there
another fix for this? And, if not, can someone help me (or point me
in the right direction) on how to update my php version?

My boss is gonna kill me if I don't get this app up and running soon.

BrianS

unread,
Jul 7, 2010, 11:42:02 AM7/7/10
to dompdf
The error you're seeing is rather generic. If you can provide any
details from the server logs (specifically the Apache/PHP error logs)
that would help track down the problem. If you're not sure where to
find that you can try turning on display of errors using the ini_set()
function.

ini_set('display_errors', 'on');

You may not be able to easily switch the specific revision of PHP you
are using. I'm not too familiar with GoDaddy's setup.

On Jul 7, 10:05 am, Justin <justin.bee...@gmail.com> wrote:
> Any help would be greatly appreciated!  I tested dompdf on my
> localhost, which is running 5.2.5 and everything has worked fine.
> When I published to my production server, however, I get an Internal
> Server Error.  Here is the complete message:
>
> ---
>
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
>
> Please contact the server administrator, supp...@supportwebsite.com

Justin Beeler

unread,
Jul 8, 2010, 11:13:34 AM7/8/10
to dom...@googlegroups.com
Here is the error in my script per the error log:

Premature end of script headers: /var/chroot/home/content/j/u/s/
justinb/html/dbe/print.php
Mind you it works fine on 5.2.8. I hope there is a viable solution,
I'm using the latest development version from SVN, downloaded just a
couple days ago.
Thanks for responding!

> --
> You received this message because you are subscribed to the Google
> Groups "dompdf" group.
> To post to this group, send email to dom...@googlegroups.com.
> To unsubscribe from this group, send email to dompdf+un...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/dompdf?hl=en
> .
>

Justin Beeler
justin...@gmail.com

Justin Beeler

unread,
Jul 8, 2010, 11:14:24 AM7/8/10
to dom...@googlegroups.com
I'm sorry, I said it worked fine on 5.2.8, I meant it worked fine on
5.2.5, but not working on 5.2.8. sorry for the mix-up.

On Jul 7, 2010, at 11:42 AM, BrianS wrote:

BrianS

unread,
Jul 8, 2010, 12:29:31 PM7/8/10
to dompdf
Is that from the apache or PHP log? I believe that is an apache
error ... and still a bit vague. Perhaps this might help?
http://htmlfixit.com/cgi-tutes/tutorial_Common_Web_dev_error_messages_and_what_they_mean.php#premature

Is GoDaddy using cPanel?
http://forums.cpanel.net/f5/solution-error-premature-end-script-headers-105245.html
> justin.bee...@gmail.com

Justin Beeler

unread,
Jul 8, 2010, 12:43:14 PM7/8/10
to dom...@googlegroups.com
I believe that is the apache error log. I used the code:

ini_set('error_log', dirname(__FILE__).'error.log');
ini_set('log_errors', 'on');


ini_set('display_errors', 'on');

... in my script but there is no error log being created anywhere on
the server. It does on my localhost, but there is no problem on my
localhost so that doesn't help.

No, GoDaddy doesn't use cPanel, they have their own thing going on.
The tech support guy says that since I'm on shared hosting I don't
have control over what version of php I'm running (except if I wanted
to revert to php4).

I'm having the same issue described in this thread:
http://code.google.com/p/dompdf/issues/detail?id=10&q=internal%20server%20error

Though, some of these people are having a separate issue, but I
believe there are a few people in there getting the same problem and
they said they're running 5.2.8 and upgrading to 5.2.9 fixed it. I
don't know if there is any helping me, I may have to find an
alternative. I just hate to re-write everything for another library
(which I've had more trouble out of than this one), but the support
for this one is great because you guys actually respond to issues.

Hope there is something that can be done...

BrianS

unread,
Jul 8, 2010, 12:49:41 PM7/8/10
to dompdf
I think it's time to do some basic hacking, then. Does this happen for
every PHP script or just when you're using DOMPDF? If it's just with
the DOMPDF script then exit() out of the script at the top and see if
any errors are produced. Move the exit() call down a line at a time
until you find the line that's causing the error.


On Jul 8, 12:43 pm, Justin Beeler <justin.bee...@gmail.com> wrote:
> I believe that is the apache error log.  I used the code:
>
> ini_set('error_log', dirname(__FILE__).'error.log');
> ini_set('log_errors', 'on');
> ini_set('display_errors', 'on');
>
> ... in my script but there is no error log being created anywhere on  
> the server.  It does on my localhost, but there is no problem on my  
> localhost so that doesn't help.
>
> No, GoDaddy doesn't use cPanel, they have their own thing going on.  
> The tech support guy says that since I'm on shared hosting I don't  
> have control over what version of php I'm running (except if I wanted  
> to revert to php4).
>
> I'm having the same issue described in this thread:http://code.google.com/p/dompdf/issues/detail?id=10&q=internal%20serv...
>
> Though, some of these people are having a separate issue, but I  
> believe there are a few people in there getting the same problem and  
> they said they're running 5.2.8 and upgrading to 5.2.9 fixed it.  I  
> don't know if there is any helping me, I may have to find an  
> alternative.  I just hate to re-write everything for another library  
> (which I've had more trouble out of than this one), but the support  
> for this one is great because you guys actually respond to issues.
>
> Hope there is something that can be done...
>
> On Jul 8, 2010, at 12:29 PM, BrianS wrote:
>
>
>
>
>
> > Is that from the apache or PHP log? I believe that is an apache
> > error ... and still a bit vague. Perhaps this might help?
> >http://htmlfixit.com/cgi-tutes/tutorial_Common_Web_dev_error_messages...
>
> > Is GoDaddy using cPanel?
> >http://forums.cpanel.net/f5/solution-error-premature-end-script-heade...

Justin Beeler

unread,
Jul 8, 2010, 1:00:58 PM7/8/10
to dom...@googlegroups.com
Only for dompdf, I wouldn't bother you otherwise.

Basically, what I'm doing is appending content to a variable called
$html. Most of my script is basically putting html markup into that
variable, then I would do this:

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("DBE_Application-$app_id.pdf");

And on 5.2.5 (on localhost) it works fine, a save dialog is opened and
the pdf file is generated as expected.

If I run the same script on server running 5.2.8, I get the error. If
I comment out the following code:

$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("DBE_Application-$app_id.pdf");

and echo $html, I get all of the markup displayed on the page
properly. No error is encountered. So I know that the error is
happening when I call these functions on the $dompdf object.

BrianS

unread,
Jul 8, 2010, 1:06:08 PM7/8/10
to dompdf
If you render a simpler document do you still encounter errors? What
about just instantiating DOMPDF without loading a document? Or loading
a document without rendering it? Streaming? If we can track down the
specific code that causes the problem it will be (somewhat) easier to
fix. Of course, some of these steps comprise quite a work load so it
may not help that much.

Justin Beeler

unread,
Jul 8, 2010, 2:24:12 PM7/8/10
to dom...@googlegroups.com
I replaced the lengthy html with a simple variable $t containing the
string "test" and it worked just fine.

I also ran a test where I commented out around one third of the
contents of $html and it worked fine. So it must be an issue of there
being too much content?

I'm using:

ini_set('memory_limit', '128M');

Is 128M really not enough or is it something else going on?

Justin Beeler

unread,
Jul 8, 2010, 2:29:25 PM7/8/10
to dom...@googlegroups.com
I've found a comment from someone who seems to be having the EXACT same issue:

Comment 6 by toscani, Jun 18, 2009
I am more or less having the same problem (FreeBSD 6.2 release p3, PHP version
5.2.8). It happens when rendering bigger pieces of HTML code (about 20kb and up).

DOMPDF does its work on smaller HTML files, but when the HTML code that needs parsing
gets too big, it throws a 500 Internal Server Error. It seems to have happened after
a PHP server update (DOMPDF didn't seem to have this problem on PHP version 5.2.6).

I've maximized the memory_limit and execution_time settings and they didn't solve the
problem. Any thoughts?


On Jul 8, 2010, at 1:06 PM, BrianS wrote:


Justin Beeler





BrianS

unread,
Jul 9, 2010, 1:42:12 PM7/9/10
to dompdf
128MB should be enough for most documents, but there are a number of
factors that can affect the resource requirements. Do you have a
sample document that causes a problem we can test against?

Justin Beeler

unread,
Jul 9, 2010, 1:59:47 PM7/9/10
to dom...@googlegroups.com
The script pulls the info from the database based on a session variable, so I'm going to generate that html and put it into a static file.

I'm attaching the file and providing a link to it on my server as well.

print_test.php

BrianS

unread,
Jul 9, 2010, 9:53:18 PM7/9/10
to dompdf
I didn't see an attached file, and the link you provided is producing
errors. Can you post again?
> http://mobetter.com/dbe/print_test.php
> ...
>
> read more »

Justin Beeler

unread,
Jul 12, 2010, 9:03:46 AM7/12/10
to dom...@googlegroups.com
I fixed the errors in the script, sorry about that. I attempted to
attach the file through my email client, not sure if that will work
properly or not. I'm going to try again, and go to the
code.google.com page to see if the file is there, if not I will attach
it through the webpage. You can try the link to the file again here:

http://mobetter.com/dbe/print_test.php

print_test.php

Justin

unread,
Jul 12, 2010, 9:05:59 AM7/12/10
to dompdf
It looks like the file attached okay.
>  print_test.php
> 25KViewDownload
> ...
>
> read more »

BrianS

unread,
Jul 12, 2010, 11:48:32 AM7/12/10
to dompdf
I am able to render successfully on my server:
http://eclecticgeek.com/dompdf/index.php?input_file=4364387010f941a1.htm&dompdf_ver=0.6.0_beta1

If I get a chance I'll take a closer look and try to set up a copy of
5.2.8 to see what's going on.
> ...
>
> read more »

Justin Beeler

unread,
Jul 12, 2010, 11:51:01 AM7/12/10
to dom...@googlegroups.com
What version of PHP are you running? Thanks, bro.

> --
> You received this message because you are subscribed to the Google
> Groups "dompdf" group.
> To post to this group, send email to dom...@googlegroups.com.
> To unsubscribe from this group, send email to dompdf+un...@googlegroups.com
> .

BrianS

unread,
Jul 12, 2010, 1:04:07 PM7/12/10
to dompdf
I use Dreamhost, they're currently up-to-date with 5.2.13. I have
shell access and can compile other versions.

On Jul 12, 11:51 am, Justin Beeler <justin.bee...@gmail.com> wrote:
> What version of PHP are you running?  Thanks, bro.
>
> On Jul 12, 2010, at 11:48 AM, BrianS wrote:
>
>
>
> > I am able to render successfully on my server:
> >http://eclecticgeek.com/dompdf/index.php?input_file=4364387010f941a1....
> ...
>
> read more »

Nick Koby

unread,
Jul 12, 2010, 5:00:22 PM7/12/10
to dompdf
I am debugging this same issue today for a client. GoDaddy PHP 5.2.8,
only works for smaller PDFs otherwise 500 Internal Server Error. Used
php5.ini to max out limits.

Everything goes smoothly until $dompdf->render(); is called.

BrianS

unread,
Jul 13, 2010, 3:33:00 PM7/13/10
to dompdf
On the command line I am seeing a segmentation fault with 5.2.8 that
doesn't occur on 5.2.13. I'll look at the release notes for the later
versions of PHP to see if I can track down the cause.

You should both lobby GD to update since they're exposing themselves
and their customers to security issues and, obviously, some stability
issues.

Justin Beeler

unread,
Jul 13, 2010, 3:39:42 PM7/13/10
to dom...@googlegroups.com
Yea, good luck to both of us with that!

ncatnow

unread,
Jul 16, 2010, 6:23:06 AM7/16/10
to dompdf
I ran into segmentation faults yesterday when using inline PHP.

I tracked it down to php_evaluator.cls.php in the evaluate method:

// eval(utf8_decode($code));
eval($code);

Removing utf8_decode stopped the segmentation fault and allowed me to
use inline PHP.

Likely it caused issues with something else and is therefore not a
fix, but a good place to start.

Cheers

Justin Beeler

unread,
Jul 16, 2010, 9:09:37 AM7/16/10
to dom...@googlegroups.com
I'm still getting the same Internal Server Error even after removing
the utf8_decode function.

Suji

unread,
Aug 14, 2010, 1:46:52 AM8/14/10
to dompdf
Any solution this problem found? I encountered the same problem.
Please help.

BrianS

unread,
Aug 17, 2010, 1:47:21 PM8/17/10
to dompdf
We are still investigating the problem. I recommend anyone interested
in the problem post relevant information on the bug report and watch
it for updates.
http://code.google.com/p/dompdf/issues/detail?id=37
Reply all
Reply to author
Forward
0 new messages