Bug with XAMPP & Postfix Sendmail [Solution]

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Bug with XAMPP & Postfix Sendmail [Solution]

Postby michael1124 » 31. July 2016 18:20

Note: This post is to help others, I was able to solve this issue with the lacking help on this issue that is currently present.

Environment:
Very recent install of Ubuntu 16.04.1
Fresh Install of XAMPP 7.0.8
Installed Postfix and mailutils
Initially attempted to use system to send mail, but changed to use gmail. Had authentication issues but all were solved.

I sent an email using the following mail command in the terminal, which sent successfully.
Code: Select all
echo "Test mail from postfix" | mail -s "Test Postfix" you@example.com


I was using example PHP code to send mail, and I put in valid addresses in exchange for the example ones. PHP failed to send the emailt
Code: Select all
<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>


The configuration from php.ini for mail:
Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "/usr/sbin/sendmail -t -i"

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =


When I attempted to send PHP mail with the mail() function, the Apache error log filled up with this message (and sometimes in the mail.log, on occasion, but usually nothing showed up there):
Code: Select all
/usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
/usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
/usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
/usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)
/usr/sbin/sendmail: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/lib/x86_64-linux-gnu/libicuuc.so.55)


After a fair amount of research, I found this post (http://stackoverflow.com/questions/20729067/php-shell-command-error-glibcxx-3-4-9-not-found) that helped me finally solve the problem. I have created this post since the other one is not directly about sending emails through postifx using PHP in XAMPP, and was difficult to find searching for solutions for this particular situation.

The fix was to replace /opt/lampp/lib/libstdc++.so.6 with /usr/lib/x86_64-linux-gnu/libstdc++.so.6. After restarting Apache, emails started working again.

I assume that file replacements such as this should not normally be necessary, which is why I described this as a bug.
michael1124
 
Posts: 1
Joined: 31. July 2016 17:42
XAMPP version: 7.0.8
Operating System: Ubuntu 16.04.1

Re: Bug with XAMPP & Postfix Sendmail [Solution]

Postby Slartibartfast » 09. November 2018 19:49

After spending days looking for a solution to the problem of PHP mail() not working on a new install of the latest mint and the latest xampp for linux V5.6.38 and the latest postfix, this post solved it.
All I needed was a local testing mail server so I could test php mail form on my dev site worked. The windows version of Xampp comes complete with Mercury mail and was easy to setup a catch all address and pick it up in Thunderbird. Is it not possible to include something similar in Xampp for linux? or at least have a version of libstdc++.so.6 that works.

So a few key words to help searches for others. I searched using these search terms along with other variants: Problem with php mail and postfix, php mail not working with postfix getting php mail() to work with on linux
Slartibartfast
 
Posts: 1
Joined: 09. November 2018 19:30
XAMPP version: 5.6.38
Operating System: Linux Mint


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 4 guests