Linux – Monitoring sendmail function (php) usage

Often we can encounter server that started to send spam (infected page, virus inside php file, bad plugin).

If its our own server we can very easily monitor usage of sendmail which is commonly used in php to send mails, and we will do it with usage of simply ‘wrapper’ .

 

1. Create /usr/local/bin/phpsendmail:

Lets check where is sendmail:

If its not in this localization /usr/sbin/sendmail then we will need to edit above script

Setup right permissions for file:

2.  Next we need edit php.ini file

If we use PHP as CGI or suPHP, you need edit also /etc/php5/cgi/php.ini

Restart service:

3. Lets test our wrapper

Create mailtest.php in www directory ex. /var/www/example.com/public_html

Open file in browser

Check if you have something in log file:

 

Facebooktwittergoogle_plusreddit

Linux – Apache Part 4: MySQL and MariaDB Database

MariaDB and MySQL are both compatible with each other, the decision is on system administrator which one will be used.

MariaDB instalation:

 

MySQL Instalation:

 

You can always go back and check those posts:

Linux – Apache Part 1: Instalation and configuration

Linux – Apache Part 2: Enable SSL

Linux – Apache Part 3: PHP

 

After now your server should be ready to use 🙂

 

Facebooktwittergoogle_plusreddit

Linux – Apache Part 3: PHP

Enabling PHP for Apache server is trivial.

Lets check if PHP really works:

Use browser to check your info.php to confirm that php is up and running on your apache server.

 

You can always go back to check those steps:

You can always go back and check those posts:

Linux – Apache Part 1: Instalation and configuration

Linux – Apache Part 2: Enable SSL

Or go forward:

Linux – Apache Part 4: MySQL and MariaDB Database

Facebooktwittergoogle_plusreddit