Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/tcpdf_autoconfig.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/public_html/sites/all/libraries/tcpdf/tcpdf.php on line 146
Comment | File | Size | Author |
---|---|---|---|
#4 | Listado de Casos Contenido Bufete Forlar.png | 177.55 KB | gbelot2003 |
Comments
Comment #1
nicxvan CreditAttribution: nicxvan commentedMaking Progress:
In tcpdf.php Made the following changes.
require_once(__DIR__.'/tcpdf_autoconfig.php');
// TCPDF static font methods and data
require_once(__DIR__.'/include/tcpdf_font_data.php');
// TCPDF static font methods and data
require_once(__DIR__.'/include/tcpdf_fonts.php');
// TCPDF static color methods and data
require_once(__DIR__.'/include/tcpdf_colors.php');
// TCPDF static image methods and data
require_once(__DIR__.'/include/tcpdf_images.php');
// TCPDF static methods and data
require_once(__DIR__.'/include/tcpdf_static.php');
TO
require_once('tcpdf_autoconfig.php');
// TCPDF static font methods and data
require_once('include/tcpdf_font_data.php');
// TCPDF static font methods and data
require_once('include/tcpdf_fonts.php');
// TCPDF static color methods and data
require_once('include/tcpdf_colors.php');
// TCPDF static image methods and data
require_once('include/tcpdf_images.php');
// TCPDF static methods and data
require_once('include/tcpdf_static.php');
More notes to follow: Still getting errors on the page but it loads.
Comment #2
nicxvan CreditAttribution: nicxvan commentedGot rid of the remaining errors by making the following changes to the tcpdf_autoconfig.php file:
if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) {
// define a list of default config files in order of priority
$tcpdf_config_files = array(__DIR__.'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php');
foreach ($tcpdf_config_files as $tcpdf_config) {
if (file_exists($tcpdf_config) AND is_readable($tcpdf_config)) {
require_once($tcpdf_config);
break;
}
}
}
if (!defined('K_PATH_MAIN')) {
define ('K_PATH_MAIN', __DIR__.'/');
}
TO
if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) {
// define a list of default config files in order of priority
$tcpdf_config_files = array('config/tcpdf_config.php', 'etc/php-tcpdf/tcpdf_config.php', 'etc/tcpdf/tcpdf_config.php', 'etc/tcpdf_config.php');
foreach ($tcpdf_config_files as $tcpdf_config) {
if (file_exists($tcpdf_config) AND is_readable($tcpdf_config)) {
require_once($tcpdf_config);
break;
}
}
}
if (!defined('K_PATH_MAIN')) {
define ('K_PATH_MAIN', '');
}
Comment #3
nicxvan CreditAttribution: nicxvan commentedSince this is a third party library I'm not entirely sure what the protocol is for patching this and fixing it.
Comment #4
gbelot2003 CreditAttribution: gbelot2003 commentedI have the same problem, I wander if is something related with third party actualizations??
Comment #5
david.goovaerts@gmail.com CreditAttribution: david.goovaerts@gmail.com commentedThe problem is that __DIR__ only works with php 5.3.0 and higher.
and you probably don't have that installed on your server.
A better solution is to replace '__DIR__' with 'dirname(__FILE__)' that does the same, but works with lower php versions.
that solved all errors for me.
thus
// TCPDF configuration
require_once(dirname(__FILE__).'/tcpdf_autoconfig.php');
// TCPDF static font methods and data
require_once(dirname(__FILE__).'/include/tcpdf_font_data.php');
// TCPDF static font methods and data
require_once(dirname(__FILE__).'/include/tcpdf_fonts.php');
// TCPDF static color methods and data
require_once(dirname(__FILE__).'/include/tcpdf_colors.php');
// TCPDF static image methods and data
require_once(dirname(__FILE__).'/include/tcpdf_images.php');
// TCPDF static methods and data
require_once(dirname(__FILE__).'/include/tcpdf_static.php');
and
// Load main configuration file only if the K_TCPDF_EXTERNAL_CONFIG constant is set to false.
if (!defined('K_TCPDF_EXTERNAL_CONFIG') OR !K_TCPDF_EXTERNAL_CONFIG) {
// define a list of default config files in order of priority
$tcpdf_config_files = array(dirname(__FILE__).'/config/tcpdf_config.php', '/etc/php-tcpdf/tcpdf_config.php', '/etc/tcpdf/tcpdf_config.php', '/etc/tcpdf_config.php');
foreach ($tcpdf_config_files as $tcpdf_config) {
if (file_exists($tcpdf_config) AND is_readable($tcpdf_config)) {
require_once($tcpdf_config);
break;
}
}
}
if (!defined('K_PATH_MAIN')) {
define ('K_PATH_MAIN', dirname(__FILE__).'/');
}
Comment #6
killua99 CreditAttribution: killua99 commentedThis is a issue for PHP 5.2.x and drupal requirements are: Drupal 7: PHP 5.2.5 or higher (recoment 5.3.x).
Comment #7
killua99 CreditAttribution: killua99 commentedOk reading very carefully, this is related with the library. Sorry I was fast editing and classifying all the issues.
The current tcpdf library * @version 6.0.020 include the file with this method:
So this means you have to update the library. I'm going to close this one. People can still find this solution for older or idk witch version have the __DIR__ magic.
Comment #8
Liam Morland