VPS

Fix “PHP Warning: fsockopen() ” Error in Opencart in cPanel & CSF

If you are using Opencart on a VPS or dedicated server and you have cPanel/WHM with Configserver Firewall (CSF) installed, you may encounter a problem when sending email.

If you check error log, you may see the similar error.

PHP Warning: fsockopen()  [function.fsockopen'>function.fsockopen]: unable to connect to ssl://smtp.gmail.com:465 (Connection timed out) in /home/XXXX/public_html/www.example.com/system/library/mail.php on line 153

You may try the following fix.

1. Logon to WHM & browse to ConfigServer Security & Firewall page.

2. Click on “Firewall Configuration” button

3. Find “SMTP_ALLOWUSER” option.

4. In the field add your cPanel username. If the is multiple username use comma to separate.

5. Click “Change” and Restart Configserver Firewall

This guide may fix other program such as Interspire Email Marketer as well.


Fix “#2006 – MySQL server has gone away” Error in phpMyAdmin

I’m importing 3.5MB csv file into the database. After file uploading completed, the following error came out.

#2006 - MySQL server has gone away

It is because MySQL server drop if there is too large packet. To fix the error follow the steps below.

1. SSH to your VPS / Server

2. Edit my MySQL file. Remember to backup your /etc/my.cnf prior to that.

vi /etc/my.cnf

3. Add or edit max_allowed_packet in the MySQL configuration file

max_allowed_packet=16M

4. Save MySQL configuration file

5. Restart mySQL

service mysql restart

If the error still persist you may try to increase the value & try again.