Hello!
Firstly let me say great site! I have been trying to learn a bit about perl today as my weapon of choice php has let me down. That said this could be a very amateur attempt at perl.
Anywho the problem I face is when piping emails to a php script (using cpanel) php produces an error:
PHP Warning: Module 'eAccelerator' already loaded in Unknown on line 0
Now unfortunately the
MTA interprets any output as a failed send thus returning mail to sender. From
www.somacon.com/p520.php it looks like the errors indicate that dynamic extensions are being loaded via .ini files, even though they are already compiled into the PHP binary.
Clearly the ideal solution involves not loading the module twice but I do not have the privileges on the shared server to change this.
I have tried piping the emails to | /path/myscript.php > null and to
| /path/myscript >> null and a few other variations.
I have tried putting a q flag on the php shebang.
I have tried turning the error reporting down with:
error_reporting(E_ERROR);
I have tried object buffering in php.
But to no avail as the error appears to be produced either on the hashbang or before it. The script now has no extension.
I should point out that it runs the entire php script properly.
So getting finally to the point I had an idea that a non php script between the MTA and the php might be able to discard (or rather log) any errors to prevent a (false) email
undelivered message. Now after a fast tutorial to perl I hacked this together:
#!/usr/bin/perl
$pipestring = "|./home/bevs/bin/email >> /dev/null";
open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
$SIG{PIPE} = 'IGNORE';
open(FH, $pipestring) or die "can't fork: $!";
while(<STDIN>)
{
my $line = $_;
print FH $line or die "can't write: $!";
}
close FH or die "can't close: $!";
Now it just pipes the email to my php script but unfortunately the same old error gets output to the MTA and the mail is (supposedly) undelivered. So how pray tell do I take the output of the php and throw it anywhere but where its currently going?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.