HEX
Server: CentOS WebPanel: Protected by Mod Security
System: Linux sites.annaiservers.com 3.10.0-1160.118.1.el7.x86_64 #1 SMP Wed Apr 24 16:01:50 UTC 2024 x86_64
User: freeval (1012)
PHP: 8.1.10
Disabled: NONE
Upload Files
File: //scripts/php_mail_log
#!/bin/bash
# CWP script to log all emails sent using php

# Main PHP
sed -i "s/.*mail.add_x_header.*/mail.add_x_header = On/" /usr/local/php/php.ini
sed -i "s@.*mail.log.*@mail.log = /usr/local/apache/logs/phpmail.log@" /usr/local/php/php.ini

# PHP Selector
sed -i "s/.*mail.add_x_header.*/mail.add_x_header = On/" /opt/alt/php*/usr/php/php.ini
sed -i "s@.*mail.log.*@mail.log = /usr/local/apache/logs/phpmail.log@" /opt/alt/php*/usr/php/php.ini

# Create Log file if not exists
if [ ! -e "/usr/local/apache/logs/phpmail.log" ];then
	touch /usr/local/apache/logs/phpmail.log
fi

# Fix permissions for file, required as executed by php as user
chmod 666 /usr/local/apache/logs/phpmail.log

# Restart all installed PHP-FPM versions
/scripts/phpfpm_service_manage restart