SOLVED: FPDF error when printing (cannot redeclare class)

Tech Support questions which aren't tied to a particular operating system

SOLVED: FPDF error when printing (cannot redeclare class)

by trendless » Fri Jan 23, 2009 6:08 pm

I've done several installs of NolaPro; one using the Windows installer and two others using a Linux LAMP. The rest of the system seems to function properly, yet every time I try to generate a PDF invoice to print it gives me:

"Fatal error: Cannot redeclare class FPDF in /opt/lampp/lib/php/fpdf.php on line 13"

Now, I tracked down said file and on line 13 it had "class FPDF" (minus the quotes, obviously). The FPDF site itself shows tutorials that have "class FPDF extends FPDF" in the same spot (before the scripting really gets started). So I added the "extends FPDF" to the file. Now it says:

"Fatal error: Cannot redeclare class FPDF in /opt/lampp/lib/php/fpdf.php on line 1732"

That's the last line of the file (unless you count the carriage return after it, which according to the FPDF site can cause problems, so I removed the carriage return). Anyone have ideas?
Last edited by trendless on Sat Jan 31, 2009 11:26 pm, edited 1 time in total.
trendless  

Re: FPDF error when printing (cannot redeclare class)

by npsupport » Tue Jan 27, 2009 10:33 am

This is not an issue with NolaPro. The file /opt/lampp/lib/php/fpdf.php is not in the NolaPro path. It looks as if your system is automatically loading fpdf.php on every page load. It causes a problem because NolaPro also uses and loads its own fpdf.php. Do you have an auto-prepend file running that is loading fpdf, or do you have some other program configured to auto-load it?
NolaPro Support Department
npsupport  

Re: FPDF error when printing (cannot redeclare class)

by trendless » Tue Jan 27, 2009 1:50 pm

Odd... I haven't done anything custom any of the times I've installed NolaPro; once I used the Windows Auto-installer, so whatever it loaded is what came with the package from the nolapro.com website, and this time I used the XAMPP package from apachefriends.org and then unpacked the nolapro archive I downloaded straight from the nolapro.com website. I followed the installer instructions to the letter this most recent time and got the same error as when I let the nolapro windows installer package do all the configuring for me. Ergo, I have not set anything to auto-prepend, nor have I configured any other programs to do anything; any loading or operations are either the nolapro package (which I have not altered in any way) or the XAMPP bundle (which I have also not altered in any way); so I'm guessing it's XAMPP, which does come with fpdf itself. Where would I find the fpdf.php file that nolapro itself loads?

I should also make note of the fact that nolapro is unpackaged in the directory /opt/lampp/htdocs/nolapro. I'm thinking that means that the php package itself is in the /opt/lampp/lib/php, so I imagine all the critical/necessary php files that nolapro requires (besides the custom ones, of course) are in that directory, right?

(Also, doesn't NolaPro *require* FPDF to be installed before it will run properly?)




PS: Sorry for the confusion, I should have specified *NOOB ALERT*
trendless  

Re: FPDF error when printing (cannot redeclare class)

by trendless » Tue Jan 27, 2009 4:10 pm

SOLVED:

I deleted the fpdf.php file in /opt/lampp/lib/php and it works.
trendless  


Return to General Tech Support Help