Hi everyone,
I've just spent several hours getting bounce.cgi working
on our hostgator.com dedicated server. It's finally working
now
and I thought I'd post details to help others out.
In fact, I have a suggestion Dean - would it be a good idea
to create a sticky post that provides working configurations
/
solutions for bounce.cgi on hosts that are known to have
issues?
That would save a lot of time.
Here are the details:
bounce.cgi on Hostgator dedicated server
===============================
These instructions are for a dedicated server but may
work on shared servers as well if you can provide your
own copy of 'wget'.
The three key items to get a working solution were:
1) Send a test email from ListMailPro to your remote email
address and view the message source to see if a
"Return-Path:" header is included.
If not, edit your config.php file and change:
$phpmailf = '';
to
$phpmailf = '1';
Until I did this the List Mail Pro mail server was not
including a Return-Path: header meaning there was no way for
bounced emails to get back to the bounce.cgi script.
2) Use a Mail Filter, not a Mail Forward in Cpanel to pipe
to the bounce.cgi script.
For some reason a Mail Forward in Cpanel refused to pipe
bounced emails to bounce.cgi no matter what I tried.
However, setting up a Mail Filter worked.
In Cpanel, click on Mail, then Email Filtering.
Add a new filter with:
"To:" equals <insert your bounce address>
Destination is:
|/home/userdir/www/cgi-bin/bounce.cgi
Note: there are NO quotes ("like this").
3) Replace wget.
As has been mentioned, hostgator does not allow users access
to wget which causes bounce.cgi to fail.
If you're on a shared server you're basically stuffed. The
only solution would be to upload a copy of wget that matches
your server OS into your cgi-bin directory and call it
something else. Then modify bounce.cgi to use that wget
instead.
This should work.
Because we own a dedicated server and have root access I
have more flexibility but still found that the server setup
was determined to not allow access to wget to users &
apache.
I added users and user "nobody" to /etc/group in the
get-users group and that didn't work.
I then tried changing the ownership of /usr/bin/wget and it
wouldn't let me even though I was the root user. I'm not
quite sure how the server is preventing me from doing that,
but it's obviously for good security reasons.
So I simply made a copy of wget and called it something else
that nobody would guess, for example:
>cp wget wget.2d4f.safe
I then modified bounce.cgi to use the new wget instead
changing:
$http_program = "/usr/bin/wget -O /dev/null " . $listmail_url . "/bounce.php";
to:
$http_program = "/usr/bin/wget.2d4f.safe -O /dev/null . $listmail_url . "/bounce.php";
And it worked (at last!)
On a shared server you could upload a copy of wget to
/home/yourusername/www/cgi-bin, change permissions to 755
and change bounce.cgi to something like:
$http_program = "/home/yourusername/www/cgi-bin/wget.2d4f.safe -O /dev/null " . $listmail_url . "/bounce.php";
I hope this is helpful to others.
Also read this thread about the "suhosin extension" which
can cause bounce.cgi to fail as well. This is what I
thought was going wrong on my server initially, but it was
unrelated.