Sending email from server using SMTP (SMTP Error, Permission denied)

I face below error for quite sometimes.

1
SMTP -> ERROR: Failed to connect to server: Permission denied (13)
After going through a lot of configuration and research, the problem occurred by SELinux is blocking the communication.
SELinux does not allow Apache (httpd,phpmailer) to use the sendmail function and make any sort of network connection.

However, the solution was found that we need to enable the sendmail protocol manually on Centos due to SELinux.
We can check the protocol setting by following below command
1
getsebool httpd_can_sendmail
And the solution is
1
2
3
4
5
setsebool -P httpd_can_sendmail 1
OR
/usr/sbin/setsebool -P httpd_can_sendmail on

MYSQL - getting -0 for double field type


While using double data type, I face some problem where MYSQL will save 0.00 as  -0
Unable to find out what is the actual problem, there for I came out with temporary solution until i found the root cause.

Since we cannot use,

select <fieldname> from <table> where <fieldname> = -0;

You can retrieve the data by using below statement.

select <fieldname> from <table> where <fieldname> = cast(<fieldname> AS CHAR(15))="-0";
UPDATE <table> SET <fieldname> = 0 WHERE cast(<fieldname> AS CHAR(15))="-0";