0

我在日志文件中看到以下条目:

    2013-08-28T17:45:09+00:00 ERR (3): Warning: include(DOMPDF.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/site/site.com/lib/Varien/Autoload.php on line 93
    2013-08-28T17:45:09+00:00 ERR (3): Warning: include(DOMPDF.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/site/site.com/lib/Varien/Autoload.php on line 93
    2013-08-28T17:45:09+00:00 ERR (3): Warning: include() [<a href='function.include'>function.include</a>]: Failed opening 'DOMPDF.php' for inclusion (include_path='/home/site/site.com/app/code/local:/home/site/site.com/app/code/community:/home/site/site.com/app/code/core:/home/site/site.com/lib:.:/usr/local/lib/php:/usr/local/php5/lib/pear')  in /home/site/site.com/lib/Varien/Autoload.php on line 93
    2013-08-28T17:45:09+00:00 ERR (3): Warning: include(Stylesheet.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/site/site.com/lib/Varien/Autoload.php on line 93
    2013-08-28T17:45:09+00:00 ERR (3): Warning: include(Stylesheet.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory  in /home/site/site.com/lib/Varien/Autoload.php on line 93

没有执行 DOMPDF_autoload 函数可能是什么原因?谢谢。

4

2 回答 2

1

The file DOMPDF.php is not part of any standard Magento installation. It appears you, or someone working on your system, has injected some custom code into your Magento system.

Somewhere in this custom code, there's a line that looks something like this

$objet = new DOMPDF;

Since this DOMPDF object hasn't been defined, PHP tries to run it through it's autoloader. The autoloader for Magento classes is "first" on the queue, and treats DOMPDF like is was a Magento class.

This means trying to include the file DOMPDF.php. Since this class isn't a Magento class, the autoloader fails. Magento's autoloader doesn't fail gracefully, and you get the errors you see.

You'll need to make sure you're including all the files in DOMPDF correctly. There's myriad ways to do this — I'd contact the developer who did the initial work, or the developer who built the extension, and have them document how they included this library.

于 2013-08-28T18:51:47.390 回答
0

我通过编辑 /lib/dompdf6/include/autoload.inc.php 解决了这个问题。这个文件的内容是:

    function DOMPDF_autoload($class) {
      $filename = DOMPDF_INC_DIR . "/" . mb_strtolower($class) . ".cls.php";

      if ( is_file($filename) )
        require_once($filename);
    }
    spl_autoload_register('DOMPDF_autoload');

这篇博文很有帮助。 http://sim.plified.com/2010/11/17/make-dompdf-work-with-magento/

请注意,代码在 PHP 版本 5.3.13 上运行。

于 2013-08-28T21:30:37.193 回答