Forums

Cannot redeclare class phpmailer

khukhas 26 Mar, 2014
Hi

I have a form that send an email on submit. But I get the following error:

Fatal error: Cannot redeclare class phpmailerException in /home/.../libraries/cegcore/vendors/phpmailer/class.phpmailer.php on line 2532

Can anybody help me?
Max_admin 26 Mar, 2014
Hi khukhas,

Do you have something on the same site sending another email at the same time ? or maybe 2 forms on the same page ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
khukhas 26 Mar, 2014
No, the page has only one form... http://cursos-dj.com/2014/escola/inscricao
khukhas 27 Mar, 2014
In addition when I try to create the form table in the database, I get a 406 error... Maybe the problem is my server...

Is the a way to workarround this?

Thanks
Max_admin 27 Mar, 2014
Bug found and fixed, maybe you had the Joomla registration action + the email action running on form submit ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
susipop 11 Apr, 2014
Hello everyone! I have been trying to solve this but have not found what is causing it. It's this same error when chronoforms try to redeclare phpmailer class. So I post it here...

This is the only chronoegine component-module I'm using –I've found out that using both chronoforms and other chrono componen may cause it–. Also, I've unistalled AcyMailing and Kunena because I found that this two components may have the same issue.
As I understand, but I'm not a programmer, this happens when chronoforms define the class but it is already defined by other component-module. Also, I've been using chronoforms in other sites but this is the first time I got the error, so I might think the problem may be the server ΒΏ?.
And, the important thing to know is that the form IS sent via email, regarding the error. When you hit send, it shows only the error, not the "thank you" message, but the email is correctly sent.
Any ideas what could be causing this?
Thank you!!πŸ˜€
susipop 11 Apr, 2014
PS. I forgot to say, I have not other action rather than a multipage send-by-email action. Not the joomla registration, not anything else :/
ThanksπŸ˜€
Max_admin 12 Apr, 2014
Hi susipop,

I have fixed this issue, you can contact me using the contact us page to get the fixed patch installer!πŸ™‚

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
susipop 25 Apr, 2014
Thank you! I've already sent the message using the Contact us form.

πŸ˜€ πŸ˜€
susipop 08 May, 2014
Hello there! It's been a while since I got the patch to fix this issue, but I had not test it until now. I'm still getting the message:

Fatal error: Cannot redeclare class phpmailerException in /home/username/public_html/libraries/phpmailer/phpmailer.php on line 2951



I've intalled the fix usign the extension manager, then I cleared CForms' cache, also joomla's cache but it was not fixed.

Do I need to do something extra?😟 Thank you so much!
Max_admin 08 May, 2014
Hi Susi,

Please download and install the latest RC6 OVER yours, let me know if this doesn't fix it!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
susipop 08 May, 2014
Ok, thanks! will let you knowπŸ˜€πŸ˜€
missnene 11 May, 2014
Thank you so much, Max! I had the same issue, and the patch worked, perfectly! πŸ˜€
susipop 03 Jul, 2014
Hello Max! It's been a while again. I keep having the same issue "Fatal error: Cannot redeclare class phpmailerException in /home/usernameforserver/public_html/libraries/phpmailer/phpmailer.php on line 2951"
Now I feel I've been doing something wrong, I've installed the patch and then the RC6 over my instalation, but with no success. I have now the latest joomla version 3.3.1 and done the normal thing about fixing the database, clearing cache...

Have you solved this? thanks!!!
susipop 03 Jul, 2014
Sorry, the version I have installed OVER my existing component is v5.0.0πŸ˜› with no success😟
Thkns!
susipop 08 Jul, 2014
Hello! any idea on how to solve this yet? thank you!!πŸ™‚
susipop 08 Jul, 2014
Hello again, I'm trying to figure out what's causing this error and thanks to this article ->http://www.acyba.com/forum/2-acymailing-bug-report/54483-fatal-error-cannot-redeclare-class-phpmailerexception.html <- I understood that you are requesting phpMailer class twice.
I'm not a programer so I cannot find the way around this one, because I don't know how to tell Cegcore not to call this class again if it's already loaded.
After looking at "libraries> cegcore> vendors> phpmailer > class.phpmailer.php" it all makes sense as in this file you're redefining this class again, the samethat is being loaded in Joomla's "libraries> phpmailes >phpmailer.php".

I hope someone out there have any idea how to change thisπŸ™‚

Thanks again
susipop 08 Jul, 2014
Me again, I've found out how to fix it: Just changed the phpmailer class name over the cegcore lib.

Hope this helps someone else!πŸ™‚
susipop 08 Jul, 2014
Here the new files.
Before doing ANY replacement, please backup first the two files you're gonna change.
You just replace:
"libraries>cegcore>libs> mailer.php" with mailer.php provided
and
"libraries>cegcore>vendors>phpmailer> class.phpmailer.php" with class.phpmailer.php provided

:)
Max_admin 09 Jul, 2014
Hi susipop,

The error should not happen, because v5 doesn't reload the phpmailer class if its already loaded, but maybe you have some Joomla extension/module which does this ?

It looks like you have changed the class name in your fix, that's not a good idea, we need to find why this issue happens.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.