emailing with PHP 7.4

wavoe

Verified User
Joined
Nov 21, 2007
Messages
64
Location
Belgium
So successfully installed PHP 7.4 and I switched some sites to use it.
By chance in fact I was doing some tests on a website (build with Wordpress) and when I filled a contact form the email was not delivered.

Checking the exim logs I got this:
Code:
2019-12-07 21:18:17 cwd=/ 5 args: /usr/sbin/sendmail -t -i -f id115@sender-domain.com
2019-12-07 21:18:17 1idgWv-0003ny-Kh acl_m_script_path '/' is never allowed for Users.
2019-12-07 21:18:17 1idgWv-0003ny-Kh <= id115@sender-domain.com U=id115 P=local S=790 id=ee711350a6bd53aa67beeb69d866dfaa@www.sender-domain.com T="Contact form" from <id115@sender-domain.com> for info@receiving-domain.com
2019-12-07 21:18:17 1idgWv-0003ny-Kh => blackhole (non-SMTP ACL discarded recipients)
2019-12-07 21:18:17 1idgWv-0003ny-Kh Completed
Switching it back to PHP 7.3 the contact form is working and the exim log is like this:
Code:
2019-12-07 21:24:37 cwd=/home/id115/domains/sender-domain.com/public_html/wp-admin 5 args: /usr/sbin/sendmail -t -i -f id115@sender-domain.com
2019-12-07 21:24:37 1idgd3-0004XJ-5j <= id115@sender-domain.com U=id115 P=local S=794 id=48ebfab05d9edecf2ec01c8875284ec2@www.sender-domain.com T="Contact form" from <id115@sender-domain.com> for info@receiving-domain.com
2019-12-07 21:24:37 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1idgd3-0004XJ-5j
2019-12-07 21:24:37 1idgd3-0004XJ-5j => info <info@receiving-domain.com> F=<id115@sender-domain.com> R=virtual_user T=dovecot_lmtp_udp S=940 C="250 2.0.0 <info@receiving-domain.com> QO7IDYUK7F0pHwAAYDDtvw Saved"
2019-12-07 21:24:37 1idgd3-0004XJ-5j Completed
So for some reason the cwd is getting not the right path.
I'm using a ninja-forms as WP plugin for the contact form and that is using PHPMailer.
Not sure yet if it's an issue there or if it's something server / PHP configuration related.
Like this I want to put the attention "on the table".
 

bdacus01

Verified User
Joined
Jul 22, 2017
Messages
672
Location
Murfreesboro
you might see if its disabled in php.ini

Could be you are using self signed ssl or not fdqn?
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,991
Code:
2019-12-07 21:18:17 1idgWv-0003ny-Kh acl_m_script_path '/' is never allowed for Users.
That's part of BlockCracking's checks. It makes use of the /etc/exim.pl's find_script_path with perl's $ENV{'PWD'}; call. It is retruning / so something changed the cwd along the way.

I've just setup php-fpm 7.4 on our CentOS 8 test box, with the latest exim.conf 4.5.18 and /etc/exim.pl 28.. but no luck on duplicating the issue.
The path was correctly sent, when I tested with the php mail() function.

Perhaps, try testing with a plain php send script, eg:
Code:
<?php
mail("some@external-email.com", "mail from mail.php mail()", "mail mail mail mail mail");
?>
and see if that hits the same / path error or not.. since we know it's not any php code changing the cwd (although, it would very odd for a php script to decide to "cd /" prior to calling the mail() function, solely based on a php version.. but it is possible, so we need to rule it out).

Let me know if you're running some other php mode, as that could also affect things (I tested with php-fpm)
 

wavoe

Verified User
Joined
Nov 21, 2007
Messages
64
Location
Belgium
Today I did a test with just the mail command.
Again there is a "/" script path using PHP 7.4 (CentOS 7 box and php mode used is php-fpm.)
When I was checking the the installed versions with custombuild on the server I saw the following message:
Code:
PHP Warning:  PHP Startup: Unable to load dynamic library 'mailparse.so' (tried: /usr/local/php74/lib/php/extensions/no-debug-zts-20190902/mailparse.so (/usr/local/php74/lib/php/extensions/no-debug-zts-20190902/mailparse.so: cannot open shared object file: No such file or directory), /usr/local/php74/lib/php/extensions/no-debug-zts-20190902/mailparse.so.so (/usr/local/php74/lib/php/extensions/no-debug-zts-20190902/mailparse.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
I could also see this warning doing: /usr/local/php74/bin/php --version

What I did now is I removed the php74 installation and I installed it again via custombuild.
Now the PHP Warning is not there anymore and the test script with the mail command is now working well.

Thank you anyways for the replies!
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,543
@wavoe, there was a bug in custombuild wich resulted in php-fpm being installed as ZTS instead of NTS when you recompiled PHP in custombuild. It was fixed in revision 2309. If that was the reason for your problem, then it would explain how it got fixed after you recompiled PHP in custombuild.

Anybody want to know if they are affected, just do:
Code:
php -v
In output you should see something like this if you are affected:
Code:
PHP 7.3.12 (cli) (built: Dec  6 2019 21:08:39) ( ZTS )
If it says ZTS, you would need to update custombuild to latest revision and recompile PHP. (Ref DirectAdmin Ticket #22653)
 
Top