Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Class 'PDFMerger' not found in /www/wwwroot/mysite/myokyawhtun/sample.php on line 5 #38

Closed
neocake opened this issue Jan 16, 2019 · 13 comments

Comments

@neocake
Copy link

neocake commented Jan 16, 2019

hi guys,
my page always die in fatal error:

Fatal error: Class 'PDFMerger' not found in /www/wwwroot/mysite/myokyawhtun/sample.php on line 5

could anyone help me ?
thanks!

@Lichtschalter-5000
Copy link

I suppose you are including 'PDFMerger.php' from your 'sample.php'-file.
Therefore, the 'PDFMerger.php' must be in the same directory. Is that the case?

@neocake
Copy link
Author

neocake commented Jan 17, 2019

I suppose you are including 'PDFMerger.php' from your 'sample.php'-file.
Therefore, the 'PDFMerger.php' must be in the same directory. Is that the case?

'PDFMerger.php' is in the same directory with sample.php,
and ,
i have tried "use(or include) PDFMerger(or PDFMerger.php);" in sample.php ,
but the scripts just die in that fatal error.
i need some help, thank you guys

@aderahenry
Copy link

Do this:

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

on sample.php. Write that on the top of the file

@neocake
Copy link
Author

neocake commented Jan 17, 2019

Do this:

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

on sample.php. Write that on the top of the file

thank you! your advice works!
but new fatal error comes:
Fatal error: Class 'PDFMerger\TCPDI' not found in /www/wwwroot/mysite/myokyawhtun/PDFMerger.php on line 87

@aderahenry
Copy link

You're welcome. For the subsequent Error, put a backslash before the class name TCPDI to make it a qualified name, like so:

$fpdi = new \TCPDI;

Do that for any subsequent Class not found error.

@neocake
Copy link
Author

neocake commented Jan 17, 2019

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

$pdf = new PDFMerger();

Problem solved, thank you all guys.

@neocake neocake closed this as completed Jan 20, 2019
@attilaking
Copy link

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

$pdf = new PDFMerger();

Problem solved, thank you all guys.

Nice, works fine. Had a lot of trouble before finding this simple solution. Thank you!

@bramanto
Copy link

Do this:

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

on sample.php. Write that on the top of the file

Thank you so much @aderahenry . The code works perfectly.

@fi5ly
Copy link

fi5ly commented Dec 19, 2019

@aderahenry thank you very much

@googlebe
Copy link

`use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

$pdf = new PDFMerger();`

oh,i am sorry,how can i do?i used the code,but the error still appear Fatal error: Class 'PDFMerger\TCPDI' not found in D:\wnmp\nginx\www\pdfmerge\PDFMerger.php

@Lichtschalter-5000
Copy link

Lichtschalter-5000 commented Mar 21, 2020

You're welcome. For the subsequent Error, put a backslash before the class name TCPDI to make it a qualified name, like so:

$fpdi = new \TCPDI;

Do that for any subsequent Class not found error.

As @aderahenry wrote...

@manduzu
Copy link

manduzu commented Apr 9, 2021

Fatal error: Uncaught Error: Class 'PDFMerger' not found in C:\xampp\htdocs\pdf\index.php:17 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pdf\index.php on line 17

hey guys what cause this error ill be happy is you will help with this error

@myokyawhtun
Copy link
Owner

@manduzu can you try like what neocake wrote before?

use PDFMerger\PDFMerger;
require_once 'PDFMerger.php';

$pdf = new PDFMerger();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants