Hi all,
as i recently found out s9y cant sent mail without the mail() function. Bad that my new hoster only supports mail sending via smtp and with auth. I looked a bit around here in the forum and finally tried to patch the serendipity_sendMail function to use pear smtp, but no luck at all. My mailsending code is working standalone without s9y on the same hoster, but if i integrate it i get a
Fatal error: Cannot redeclare _pear_call_destructors() (previously declared in <s9yblog>/bundled-libs/PEAR.php:744) in /usr/local/lib/php/PEAR.php on line 796
Any idea whats going wrong and how to fix it?
Thanks,
azarai
Sending mails with SMTP auth and PEAR - got stuck
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Sending mails with SMTP auth and PEAR - got stuck
Hi!
I suppose your plugin code uses a server-side PEAR instead of the bundled one - or the other way round. Try to make sure that the include/require statements you add use the proper PEAR. Have a look at other s9y plugins how they bundle PEAR stuff, like the serendipity_event_xmlrpc plugin?
HTH,
Garvin
I suppose your plugin code uses a server-side PEAR instead of the bundled one - or the other way round. Try to make sure that the include/require statements you add use the proper PEAR. Have a look at other s9y plugins how they bundle PEAR stuff, like the serendipity_event_xmlrpc plugin?
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
I've never really worked with this php stuff and whatever i try i end up with the same error on the server. The plugin code so far can be found http://codeboje.de/downloads/serendipity_event_smtp.zip . I'd appreciate if someone takes a look and tells me why its not working and how to fix the damn thing. btw under windows with my s9y example install i got it working, but not on my hoster when theres already a PEAR installation.
Other scripts outside of s9y work fine there too, just not as a my s9y plugin.
Other scripts outside of s9y work fine there too, just not as a my s9y plugin.
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
It might be that you simply copied the Net/SMTP.php file into your bundled-libs s9y directory, right?
That might conflict with the settings of s9y, if you don't modify the Net/SMTP.php file to use the right PEAR.php inclusion call.
By default in that file it looks like:
That will include a locally existing PEAR. You should modify it to:
or, alternative to:
Sadly some PEAR classes do not check for already included PEAR, and try to force including a local pear instead of bundled PEARs. In the distro of s9y we modified the PEAR files so that they only load the required one.
The other way to deal with it would be to completely rely on your server-side installation of PEAR, and do not bundle the SMTP.php file inside your plugin/s9y directory.
It's all actually very complicated if a local PEAR is installed and in your include path, and s9y uses its own PEAR. Sadly this lies in the structure of PEAR and that it wants to always think its globally installed instead of bundled with any applications like Serendipity.
HTH,
Garvin
It might be that you simply copied the Net/SMTP.php file into your bundled-libs s9y directory, right?
That might conflict with the settings of s9y, if you don't modify the Net/SMTP.php file to use the right PEAR.php inclusion call.
By default in that file it looks like:
Code: Select all
require_once 'PEAR.php';
require_once 'Net/Socket.php';
Code: Select all
require_once dirname(__FILE__) . '/../PEAR.php';
require_once dirname(__FILE__) . '/Net/Socket.php';
Code: Select all
if (!class_exists('PEAR')) {
require_once 'PEAR.php';
}
require_once 'Net/Socket.php';
The other way to deal with it would be to completely rely on your server-side installation of PEAR, and do not bundle the SMTP.php file inside your plugin/s9y directory.
It's all actually very complicated if a local PEAR is installed and in your include path, and s9y uses its own PEAR. Sadly this lies in the structure of PEAR and that it wants to always think its globally installed instead of bundled with any applications like Serendipity.
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
thanks garvin, i'll try that out later.
azarai
How? I tested it without the STMP.php in my plugin, but it didnt work, same error. So i obviously am doing something wrong. How do i configure s9y to rely on the server installed PEAR and not its own bundled one?The other way to deal with it would be to completely rely on your server-side installation of PEAR, and do not bundle the SMTP.php file inside your plugin/s9y directory.
azarai
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
to
you still get the error of PEAR.php duplicate inclusion?
Serendipity decides to use PEAR or not using the $serendipity['use_PEAR'] variable (declared in serendipity_config.inc.php).
HTH,
Garvin
So if you change theHow? I tested it without the STMP.php in my plugin, but it didnt work, same error. So i obviously am doing something wrong. How do i configure s9y to rely on the server installed PEAR and not its own bundled one?
Code: Select all
require_once dirname(__FILE__) . '/PEAR/Net/SMTP.php';
Code: Select all
require_once 'Net/SMTP.php';
Serendipity decides to use PEAR or not using the $serendipity['use_PEAR'] variable (declared in serendipity_config.inc.php).
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
So i got some time to test it and the following code works now. Dont know if it will work somewhere else ![Smile :-)](./images/smilies/icon_smile.gif)
In my Plugin i use:
And in the plugin bundle SMTP.php:
Every other version did either give me an "Cannot redeclare _pear_call_destructors" or a "Net_Socket class not defined".
![Smile :-)](./images/smilies/icon_smile.gif)
In my Plugin i use:
Code: Select all
require_once dirname(__FILE__) . '/PEAR/Net/SMTP.php';
Code: Select all
if (!class_exists('PEAR')) {
require_once 'PEAR.php';
}
if (!class_exists('Net_Socket')) {
require_once dirname(__FILE__) . '/PEAR/Net/Socket.php';
}
Every other version did either give me an "Cannot redeclare _pear_call_destructors" or a "Net_Socket class not defined".
Happened to me in a similar situation - flickr sidebar
Hello,
just for the archives / others, who may search for this:
the plugin serendipity_plugin_flickr stopped working for me suddenly .
Maybe the s9y 1.3.1 update or debian update broke it , but i cannot say.
I tried fixing it the same way, after 30 minutes hacking here and there i moved to serendipity_plugin_flickrbadge , which works for me fine.
Maybe this info is useful for others to.
Andre
just for the archives / others, who may search for this:
the plugin serendipity_plugin_flickr stopped working for me suddenly .
Maybe the s9y 1.3.1 update or debian update broke it , but i cannot say.
I tried fixing it the same way, after 30 minutes hacking here and there i moved to serendipity_plugin_flickrbadge , which works for me fine.
Maybe this info is useful for others to.
Andre