Search code examples
phpemailcpanelpiping

Problem with piping emails to script


I have a script to capture emails that are piped to it, parse the parts and insert them into a database. The script works fine and I've tested it over and over forwarding my own email to it. However, when I forward the client's email to the same script, the emails bounce with the following error:

PHP Warning: PHP Startup: Unable to load dynamic library '/etc/ixed/ixed.4.4.lin' - /etc/ixed/ixed.4.4.lin: undefined symbol: empty_string in Unknown on line 0

I've done the following to try and correct other problems that were causing bounces, but this one seems to be at a lower level:

  • added "-q" to the pipe command, such as "|/usr/bin/php -q /home/path/to/script"
  • added error_reporting(0) to top of script
  • Ensured there are no blank spaces outside of the <%%> tags to cause output.

If anyone has seen this before and found a solution, I'd be grateful.


Solution

  • Your error_reporting setting is to late (the error is a start up one, before error_reporting is called). Options (in personally prefered order):

    • Fix the incorrect PHP setting somewhere (run php --ini to check which files are loaded and remove the line(s) referencing ixid or fix the library itself)
    • Run with complete default settings (so no php.ini is loaded: | /usr/bin/php -n /home/path/to/script
    • Run with displaying of errors suppressed: | /usr/bin/php -d display_errors=0 /home/path/to/script

    It might not a bad idea to run with display_errors off by default of course, and only log errors, as your users should never have to deal with errors & error-descriptions they can't fix themselves.