MaheswariRamachandran / dompdf

Automatically exported from code.google.com/p/dompdf
0 stars 0 forks source link

Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Permission denied on #294

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

http://192.168.1.105/dompdf/dompdf.php?input_file=download/fRlNedmz.html&paper=l
etter&output_file=download/fRlNedmz.pdf

What is the expected output? What do you see instead?

PDF Download.

Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Permission 
denied on Your dompdf CHROOT is set to / Your CHROOT is /var/www/public/dompdf 
' in /var/www/public/dompdf/dompdf.php:269 Stack trace: #0 {main} thrown in 
/var/www/public/dompdf/dompdf.php on line 269 

What version of the product are you using? On what operating system?

Linux 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC 2011 i686 
GNU/Linux

Please provide any additional information below.

As you can see from my error message I amended it to make it more verbose.

Here is the code which produces the error message:
throw new DOMPDF_Exception("Permission denied on ".$file." Your dompdf CHROOT 
is set to ".DOMPDF_CHROOT." Your CHROOT is ".getcwd()." ");

Here is the error it produces:
Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Permission 
denied on Your dompdf CHROOT is set to / Your CHROOT is /var/www/public/dompdf 
' in /var/www/public/dompdf/dompdf.php:269 Stack trace: #0 {main} thrown in 
/var/www/public/dompdf/dompdf.php on line 269 

I have set DOMPDF_CHROOT to '/' for debugging purposes:
def("DOMPDF_CHROOT", "/");

Original issue reported on code.google.com by ryandewh...@gmail.com on 30 May 2011 at 12:42

GoogleCodeExporter commented 9 years ago
Just to confirm, even with DOMPDF_CHROOT set to "/" you are receiving the 
chroot error? I ran a quick test using a file from www/test and did not 
experience any errors.

From the error message it looks like $file is empty when it gets to the CHROOT 
check. Could there be a function somewhere up the line that isn't supported on 
your system (namely rawurldecode or realpath)? Which version of PHP are you 
running?

Original comment by eclecticgeek on 31 May 2011 at 2:17

GoogleCodeExporter commented 9 years ago
hi I also have this problem

DOMPDF_CHROOT is DEF as c:\webservices via $PATHAPPLICATION 
The files is is in 
C:\Webservices\admin\content\produits\pdf_tool\cache\Working\html

I'm running as a command line script and calling the class directly 
I'm using the nightly build from 30/6/2011

The behaviour when running without debugging is that the creation of the PDF 
sits in limbo.  

At first i did't see this because the escape url was falling over silently, 
without causing the process to exit. when it run into a path like 
...Working\\html\page1-Randomname_html. 

I only caught the error after hooking up a debugger ... at first i thought i 
was dealing with the mystery infinite loop 

Thanks Jay

Original comment by jay.ben...@gmail.com on 1 Jul 2011 at 5:56

GoogleCodeExporter commented 9 years ago
the function was dompdf.cls.php -> load_html_file

to work around comment out the check 

$realfile = realpath($file);
if ( !$file ) throw new DOMPDF_Exception("File '$file' not found.");

/*BEGIN*/
//  if ( strpos($realfile, DOMPDF_CHROOT) !== 0 )throw new 
DOMPDF_Exception("Permission denied on $file.");
/*END*

// Exclude dot files (e.g. .htaccess)
if ( substr(basename($realfile),0,1) === "." ) throw new 
DOMPDF_Exception("Permission denied on $file.");

Original comment by jay.ben...@gmail.com on 1 Jul 2011 at 6:02

GoogleCodeExporter commented 9 years ago
in frame_tree.cls.php

The rows section is stuck in a loop. I commented out appendChild($Row) to allow 
it to continue .. there was no obviouse issue. 

however it has not fixed my second infinite loop issue .. but i think thats 
stylesheet related. 

protected function fix_tables(){
    $xp = new DOMXPath($this->_dom);

    /*$captions = $xp->query("//table/caption");
    foreach($captions as $caption) {
      $tr = $this->_dom->createElement("tr");
      $tr = $caption->parentNode->insertBefore($tr, $caption);
      $tr->appendChild($caption);
    }*/

    $rows = $xp->query("//table/tr");
    foreach($rows as $row) {
      $tbody = $this->_dom->createElement("tbody");
      $tbody = $row->parentNode->insertBefore($tbody, $row);
//      $tbody->appendChild($row);
    }
  }

FYI : this is not a fix ... it was just what i did to get the debugger to 
cont.. i dont understand the implication yet. 

Original comment by jay.ben...@gmail.com on 1 Jul 2011 at 7:27

GoogleCodeExporter commented 9 years ago
@jay.bennie the problem you're encountering with DOMPDF_CHROOT is case-related 
(c:\webservices != C:\Webservices). Since case is irrelevant on Windows we 
should either ignore case or check OS type and use the appropriate test.

If you still need help with your infinite loop head on over to the support 
forum. It's a known issue, so no need to post a new bug (unless your situation 
proves to be unique).

Original comment by eclecticgeek on 7 Jul 2011 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by eclecticgeek on 24 May 2013 at 3:00