简体   繁体   English

将电子邮件发送到脚本的问题

[英]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 PHP警告:PHP启动:无法加载动态库'/etc/ixed/ixed.4.4.lin'-/etc/ixed/ixed.4.4.lin:未定义符号:empty_string in未知,第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" 在管道命令中添加了“ -q”,例如“ | / usr / bin / php -q / home / path / to / script”
  • added error_reporting(0) to top of script 在脚本顶部添加了error_reporting(0)
  • 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. 如果有人以前看到过这种情况并找到了解决方案,我将不胜感激。

Your error_reporting setting is to late (the error is a start up one, before error_reporting is called). 您的error_reporting设置太晚了(错误是在调用error_reporting之前的启动错误)。 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) 在某处修复错误的PHP设置(运行php --ini以检查加载了哪些文件,并删除引用ixid的行或修复库本身)
  • Run with complete default settings (so no php.ini is loaded: | /usr/bin/php -n /home/path/to/script 使用完整的默认设置运行(因此不加载php.ini: | /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 与抑制错误显示运行: | /usr/bin/php -d display_errors=0 /home/path/to/script | /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. 当然,默认情况下关闭display_errors并运行仅记录错误可能不是一个坏主意,因为您的用户永远不必处理自己无法修复的错误和错误说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM