Friday, December 26, 2014

Update HOST file in Mac OS X

Update HOST file in Mac OS X
Environment: Mac OS X


Host File Path: /private/etc/hosts

#sudo nano /private/etc/hosts

Saturday, May 17, 2014

Shopping Cart with phpmailer - Unable to connect to server / Could not instantiate mail function in PHPMailer

Shopping Cart with phpmailer - Could not connect to server /  Could not instantiate mail function in PHPMailer
Environment: Centos 6.4 / 


I spent a long time on this fucking damn problem, so I hope it can give you some clues on your situation.

Symptoms:
I configured the smtp servver with port number, but it keep pop me a message saying could not connect,
I able to telnet the SMTP server on the machine, and send mail in command mode, iptables allows those traffic,
but, phpmailer keep fail me no matter the mode I configure [SMTP / mail / sendmail]

I don't waste your time to read my investigation, let's see the solution

Solution:
It caused by the module SELinux is enabled in Linux, which blocked all the mail sent through httpd

you can checked the status of your system by the following command


plus, you should check the parameter httpd_can_sendmail is off or not.


if SELINUX is enforcing & httpd_can_sendmail is off, that's the reason the connection was failed.
input the command below to turn is on




In my case, the email feature resumed normal, hope it can help you

延伸閱讀 Extended Reading
What is SELinux?
will be answer on my next post.

Sunday, February 02, 2014

PDF is Corrupted in WP Download Manager

PDF is Corrupted in WP Download Manager
Environment:Wordpress 3 with plugin Ngg Gallery & WP Download Manager

I've encounter a problem with wp download manager.
I setup a download page with the plugin, to letting people download PDF from the website

The page looks good, and the files are able to download, but, the PDF is corrupted after uploaded.
The PDF was no problem before upload to the site, after searching around, I got the answer from WP forum.

The cause is WP Download Manager cannot live with another plugin "NGG Gallery"

Thanks god,  there is a workaround from the expert:
Place the function to
/plugins/download-manager/download-manager.php




function wpdm_skip_ngg_resource_manager($r){
    return false;
}
add_filter('run_ngg_resource_manager', 'wpdm_skip_ngg_resource_manager');

So, they don't need to separate with each other forever and ever.


延伸閱讀 Extended Reading
Any Side effects?
At the moment, No.

What's  run_ngg_resource_manager?
It is a new function which introduced in version 2.0.11 NGG Gallery.

The Change Log & Description as below:
NEW: Added “run_ngg_resource_manager” hook to by-pass our resource manager