Swiftmail 无法使用 sendmail/postfix

Swiftmail 无法使用 sendmail/postfix

当我尝试运行一些 Kohana swiftmailer 时,我在邮件日志中收到以下错误:

Jul 23 17:18:37 ads postfix/sendmail[5818]: fatal: execv /usr/libexec/postfix/smtpd: Permission denied

输出ls -l /usr/libexec/postfix

total 7116
-rwxr-xr-x. 1 root root 226120 Feb 20 10:07 anvil
-rwxr-xr-x. 1 root root 275752 Feb 20 10:07 bounce
-rwxr-xr-x. 1 root root 383976 Feb 20 10:07 cleanup
-rwxr-xr-x. 1 root root 246696 Feb 20 10:07 discard
-rwxr-xr-x. 1 root root 246696 Feb 20 10:07 error
-rwxr-xr-x. 1 root root 234408 Feb 20 10:07 flush
-rwxr-xr-x. 2 root root 448872 Feb 20 10:07 lmtp
-rwxr-xr-x. 1 root root 337128 Feb 20 10:07 local
-rw-r--r--. 1 root root  26830 Feb 20 10:07 main.cf
-rwxr-xr-x. 1 root root 155976 Feb 20 10:07 master
-rw-r--r--. 1 root root   5113 Feb 20 10:07 master.cf
-rwxr-xr-x. 2 root root 308104 Feb 20 10:07 nqmgr
-rwxr-xr-x. 1 root root 295816 Feb 20 10:07 oqmgr
-rwxr-xr-x. 1 root root 234440 Feb 20 10:07 pickup
-rwxr-xr-x. 1 root root 284104 Feb 20 10:07 pipe
-rw-r--r--. 1 root root  18413 Feb 20 10:07 postfix-files
-rwxr-xr-x. 1 root root   8087 Feb 20 10:07 postfix-script
-rwxr-xr-x. 1 root root   6543 Feb 20 10:07 postfix-wrapper
-rwxr-xr-x. 1 root root  24736 Feb 20 10:07 post-install
-rwxr-xr-x. 1 root root   8419 Feb 20 10:07 postmulti-script
-rwxr-xr-x. 1 root root 213800 Feb 20 10:07 proxymap
-rwxr-xr-x. 2 root root 308104 Feb 20 10:07 qmgr
-rwxr-xr-x. 1 root root 255040 Feb 20 10:07 qmqpd
-rwxr-xr-x. 1 root root 222024 Feb 20 10:07 scache
-rwxr-xr-x. 1 root root 238568 Feb 20 10:07 showq
-rwxr-xr-x. 2 root root 448872 Feb 20 10:07 smtp
-rwxr-xr-x. 1 root root 531616 Feb 20 10:07 smtpd
-rwxr-xr-x. 1 root root 222208 Feb 20 10:07 spawn
-rwxr-xr-x. 1 root root 234568 Feb 20 10:07 tlsmgr
-rwxr-xr-x. 1 root root 242896 Feb 20 10:07 trivial-rewrite
-rwxr-xr-x. 1 root root 230280 Feb 20 10:07 verify
-rwxr-xr-x. 1 root root 275464 Feb 20 10:07 virtual

我曾尝试运行rpm -qa | xargs rpm --setugids

但这似乎并不能解决问题。

答案1

这只是一种预感,但我怀疑你可能正在使用 PHP 的safe_mode函数,如下所示http://php.net/manual/en/ini.sect.safe-mode.php。可执行文件可能位于 之外safe_mode_exec_dir,因此 PHP 拒绝执行它。

您的 /usr/libexec/postfix 目录的权限没有任何问题。在我的 CentOS 6.5 机器上,权限完全相同:

 total 7116
-rwxr-xr-x 1 root root 226120 Feb 20 03:07 anvil
-rwxr-xr-x 1 root root 275752 Feb 20 03:07 bounce
-rwxr-xr-x 1 root root 383976 Feb 20 03:07 cleanup
-rwxr-xr-x 1 root root 246696 Feb 20 03:07 discard
-rwxr-xr-x 1 root root 246696 Feb 20 03:07 error
-rwxr-xr-x 1 root root 234408 Feb 20 03:07 flush
-rwxr-xr-x 2 root root 448872 Feb 20 03:07 lmtp
-rwxr-xr-x 1 root root 337128 Feb 20 03:07 local
-rw-r--r-- 1 root root  26830 Feb 20 03:07 main.cf
-rwxr-xr-x 1 root root 155976 Feb 20 03:07 master
-rw-r--r-- 1 root root   5113 Feb 20 03:07 master.cf
-rwxr-xr-x 2 root root 308104 Feb 20 03:07 nqmgr
-rwxr-xr-x 1 root root 295816 Feb 20 03:07 oqmgr
-rwxr-xr-x 1 root root 234440 Feb 20 03:07 pickup
-rwxr-xr-x 1 root root 284104 Feb 20 03:07 pipe
-rw-r--r-- 1 root root  18413 Feb 20 03:07 postfix-files
-rwxr-xr-x 1 root root   8087 Feb 20 03:07 postfix-script
-rwxr-xr-x 1 root root   6543 Feb 20 03:07 postfix-wrapper
-rwxr-xr-x 1 root root  24736 Feb 20 03:07 post-install
-rwxr-xr-x 1 root root   8419 Feb 20 03:07 postmulti-script
-rwxr-xr-x 1 root root 213800 Feb 20 03:07 proxymap
-rwxr-xr-x 2 root root 308104 Feb 20 03:07 qmgr
-rwxr-xr-x 1 root root 255040 Feb 20 03:07 qmqpd
-rwxr-xr-x 1 root root 222024 Feb 20 03:07 scache
-rwxr-xr-x 1 root root 238568 Feb 20 03:07 showq
-rwxr-xr-x 2 root root 448872 Feb 20 03:07 smtp
-rwxr-xr-x 1 root root 531616 Feb 20 03:07 smtpd
-rwxr-xr-x 1 root root 222208 Feb 20 03:07 spawn
-rwxr-xr-x 1 root root 234568 Feb 20 03:07 tlsmgr
-rwxr-xr-x 1 root root 242896 Feb 20 03:07 trivial-rewrite
-rwxr-xr-x 1 root root 230280 Feb 20 03:07 verify
-rwxr-xr-x 1 root root 275464 Feb 20 03:07 virtual

您可以检查 /etc/php.ini 以了解当前的安全模式设置:

; Safe Mode
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode
safe_mode = Off

相关内容