Example value for sendmail_path in sapi/fpm/www.conf.in seems to be encouraging bad practice
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.1k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
Description
The file sapi/fpm/www.conf.in currently contains the following line:
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
I think the intent of this is really to illustrate the use of php_admin_value rather than provide guidance on setting sendmail_path; however, I think a lot of people actually want to configure their sendmail_path and then they see this example, and then they blindly copy and paste it (just changing the path and email address as needed) without really thinking about it much. The problem is that including the -f option in sendmail_path is generally a bad practice and should be avoided.
The reason this is bad is that the PHP mail() function has a parameter $additional_params which is intended to be used to specify the -f option. But if you specify an -f option in $additional_params and there is already an -f option in sendmail_path, you end up passing the -f option to sendmail twice. This may cause sendmail to fail completely, possibly with an error message like More than one "from" person.
For many, many years, there have been lots of people having trouble with this:
https://mantisbt.org/forums/viewtopic.php?t=24647
https://github.com/magento/magento2/issues/20033#issuecomment-532289611
https://bugs.php.net/bug.php?id=53984
https://github.com/bcit-ci/CodeIgniter/issues/4343
https://forum.joomla.org/viewtopic.php?f=622&t=727375
https://www.vmayo.com/docs/fixed-phpmailer-smtp-error-could-not-connect-to-smtp-host-2/#11-toc-title
... and so on ...
I was wondering why there seem to be so many people dealing with poorly configured sendmail_path values... I think at least part of the problem may be this example code in the PHP-FPM www.conf file.
Can this example be changed to something else? Maybe something like this:
;php_admin_value[sendmail_path] = /path/to/sendmail -t -i
PHP Version
This issue has existed in every PHP version since PHP-FPM was merged into it (and possibly it existed in the separate PHP-FPM project before that).
Operating System
No response
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Xem lại sapi/fpm/www.conf.in và ví dụ sendmail_path hiện có đang được chú thích. Xóa tùy chọn -f khỏi ví dụ trong khi vẫn giữ phần minh họa php_admin_value, sau đó xác minh rằng giá trị được ghi trong tài liệu khớp với dạng được đề xuất trong issue và không chỉ định địa chỉ người gửi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- backend
- Loại issue
- Tài liệu
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 48/100