Tuesday, December 31, 2013

Step-by-step guide to transfering your web hosting to a new web host with domain transfer

If you are planning to move your website to a new host along with domain transfer, here are some easy tips to follow.
  1. First, allow plenty of time- at least a week before your hosting plan expires. You do not have to let your existing host know about your plan to move away from them. However, you have to be aware of the auto-renewal feature. Your existing host may have auto-renewal turned on in your account. What this does is - they auto renew your hosting and/or domain 7 to 14 days prior to the expiry date. If you are not sure, check with them if they have auto-renewal enabled in your account. If they have it enabled, request for the auto-renewal to be turned off. You can then take your time to transfer your hosting and/or domain.
  2. Backup everything from your existing web space - all files and folders inside the /public_html or /www folder and the databases.

Monday, September 2, 2013

MailChimp API V2.0 SSL error solution

I got this SSL error while trying to use MailChimp API V2.0 in my localhost.

Fatal error: Uncaught exception 'Mailchimp_HttpError' with message 'API call to lists/list failed: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in C:\Installation\xampp\htdocs\mailchimp-test\Mailchimp.php:192 Stack trace: #0 C:\Installation\xampp\htdocs\mailchimp-test\mailchimp-api.php(16): Mailchimp->call('lists/list', Array) #1 {main} thrown in C:\Installation\xampp\htdocs\mailchimp-test\Mailchimp.php on line 192 

To resolve this, you can try any of the methods below.

Method 1:
  • Download cacert.pem file from here: http://curl.haxx.se/docs/caextract.html
  • Save the file in your PHP installation folder. I am using xampp. So I saved it in C:\Installation\xampp\php\cacert.pem
  • Open your php.ini file and add this line:
  • Restart your Apache server and that should fix it.
Method 2:
If you are unable to edit php.ini file, there is a quick workaround.
  • Open the MailChimp API file (it's most likely named Mailchimp.php or MailChimp.class.php).
  • Look for statements starting with "curl_setopt".
  • Right below the set of "curl_setopt" statements, add this line:
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Both methods should work but method 1 is probably more reliable.

Wednesday, March 6, 2013

MySQL: How to delete records by date

Delete records where date is less than a certain date:
DELETE FROM `tablename` WHERE `date` < '2012-08-01';

You can also include intervals:
DELETE FROM `tablename` WHERE `date`  < DATE_SUB(NOW(), INTERVAL 2 DAY);

Wednesday, February 20, 2013

Concrete5: Unable to get permission key for read

C5 version

I was creating a block. It wasn't finished. While I was tweaking the code, I got this error: Unable to get permission key for read. The CCM bar disappeared and I was unable to go back to the homepage.

After searching through the forums, I am still unable to find a perfect solution at the time of this writing.

If you get this error, you can try the following:
  • Go directly to your dashboard such as http://localhost/site/dashboard
  • Go to Cache and Speed Settings
  • Turn off Basic Cache and Overrides Cache
  • Clear Cache
See if you can access your homepage now. If it still doesn't work, uninstall the block you are working on. You can then reinstall it again. That worked for me!

Tuesday, February 12, 2013

Concrete5: Using "key" as table field name gives MySQL error

Tested in v5.6.0.2.

When you are writing table schema for a block in db.xml and have field name as "key", this generates MySQL syntax error while trying to install a package. Just rename the field name to something else. I think it's because "key" already represents a primary key attribute and using the same name again in field name somehow causes conflict.