Search code examples
phprequirefpdf

Please, help me to connect a file that is in another folder in PHP script


Figured out the error "FPDF error: Unexpected end of stream", FPDF class is in the folder / FPDF/fpdf.php, but if I did I connect this way -

require ('/FPDF/fpdf.php');

Then an error PHP

Fatal error: require () [function.require]: Failed opening required '.. / FPDF / fpdf.php' (include_path = '. :/ Usr / lib / php :/ usr / local / lib / php') in / home/u552896297/public_html/createPdfFromBase64.php on line 20

Tell me how to attach a file that is in another folder?

I tried to connect this way -

require ($ _SERVER ['DOCUMENT_ROOT']. '/ FPDF / fpdf.php');

But after that, in general, and covered with Warnings and Fatal Error (((

Warning: require () [function.require]: open_basedir restriction in effect. File (/ usr / local / apache / htdocs / FPDF / fpdf.php) is not within the allowed path (s): (/ home / :/ usr / lib / php :/ tmp :/ usr / share / locale) in / home/u552896297/public_html/createPdfFromBase64.php on line 20

Warning: require (/ usr / local / apache / htdocs / FPDF / fpdf.php) [function.require]: failed to open stream: Operation not permitted in / home/u552896297/public_html/createPdfFromBase64.php on line 20

Fatal error: require () [function.require]: Failed opening required '/ usr / local / apache / htdocs / FPDF / fpdf.php' (include_path = '. :/ Usr / lib / php :/ usr / local / lib / php ') in / home/u552896297/public_html/createPdfFromBase64.php on line 20


Solution

  • open_basedir is not active in your config php...

    You can change this in your php.ini
    http://www.php.net/manual/en/ini.core.php#ini.open-basedir