ksechrist

Active Member
Jan 27, 2019
31
5
8
Texas
cPanel Access Level
Root Administrator
My IPs are clean, but a bunch in my /16 block are listed on Barracuda's RBL and Charter is blocking me because of it. I'm staying on my host to get these cleaned up, but meanwhile I thought it would be good to monitor for issues on my server.

So I added this to all my php.ini files for each php version, tried root owner and apache (nobody) owner, even tried setting permission to 777, yet the log remains blank.

Tried this first:
Code:
mail.add_x_header = On
mail.log = /var/log/phpmail.log
When that didn't work, I found someone else having the same trouble but they got it working by using the tmp folder, so I tried :

Code:
mail.add_x_header = On
mail.log = /var/tmp/phpmail.log
I restarted Apache after changing the php.ini files - is there something else I need to do to get this working?
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,080
657
263
Houston
cPanel Access Level
DataCenter Provider
it's writing the headers, it's just not logging. The headers don't help though if I don't receive the spam!
My initial concern was whether or not any of it was working, or just the logging. It sounds like it's just the logging. If you create
/var/log/phpmail.log as the user does it output to the log? This is more of a system administration task but I'm curious as well at this point. I may try this on a test system to see if I can get it to work as well.
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
Texas
cPanel Access Level
Root Administrator
I tried changing the owner and group for the log to one of the account users - I hope this is essentially the same as creating the log as the user? It didn't work.
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
Texas
cPanel Access Level
Root Administrator
I started with global... then tried local on one of the sites... when I tried local, I even tried changing group/owner to that site's user/group... I'm starting to think I've tried everything, but there must be something I'm missing! Thank you for trying to help! :)
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,080
657
263
Houston
cPanel Access Level
DataCenter Provider
I got it to work on my test server here's what I did:

1. added the following:
Code:
mail.add_x_header = On
mail.log = /var/tmp/phpmail.log
to the global php.ini for php 7.1 - this must be done through WHM's MultiPHP INI Manager

2. Created a test PHP mail script - for purposes of this testing I used 777 perms on it

3. Ran the script over CLI with the following:

Code:
ea-php71 test-email.php
To run it this way you need to run it from the directory where the script resides otherwise you'll need to call the full path

4. Checked /var/tmp/phpmail.log and found:

Code:
[15-May-2019 21:00:43 UTC] mail() on [/home/myuser/public_html/test-email.php:9]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script
[15-May-2019 21:09:12 UTC] mail() on [/home/myuser/public_html/test-email.php:9]: To: [email protected] -- Headers: From:[email protected] -- Subject: PHP Mail Test script
 

ksechrist

Active Member
Jan 27, 2019
31
5
8
Texas
cPanel Access Level
Root Administrator
:( I'm still on EasyApache3 so no multiphp ini manager...

I've known I needed to do this update, but the last time I did a major update (cpanel was 10 versions behind when I got this server) it broke all kinds of things. I also have an old application running php 5.3 - I'll have to find out if it will work on 5.4.

Thank you for trying so hard Lauren... I really appreciate it. And now I got the kick I needed to move forward with upgrading my application and easyapache (or changing to another hosting company altogether)
 

cPanelLauren

Forums Analyst II
Staff member
Nov 14, 2017
8,080
657
263
Houston
cPanel Access Level
DataCenter Provider
Hi @ksechrist

I'm happy to help, I, unfortunately, can't try this on an EasyApache 3 system but the primary difference would be the global php.ini in /usr/local/lib/php.ini, I'd assume.

I can't stress to you enough how important it is to keep cPanel and your php up to date. If your sites can handle newer versions of PHP and you want help migrating to EasyApache 4 please open a ticket with us and we'd be more than happy to assist with that.