openssl_sign(): supplied key param cannot be coerced into a private key

Hello, just wanted to write something coming back after a long time. Please excuse my absence, life has been very busy with so much other priorities.

This post is for those who are using a PHP-DKIM solution and experiencing this below error –

openssl_sign(): supplied key param cannot be coerced into a private key

This happens when you have inputted a wrong private key input in the openssl_sign(). The third parameter is actually the “private key id” received from a call on openssl_get_privatekey(). But often its mistakenly gets passed with a string value of the private key lines.

So, here is the solution –
1) Prepare the “private key id”:
$fp = fopen("/path/to/file/.htkeyprivate", "r");
$privKey = fread($fp, 8192);
$pKeyId = openssl_get_privatekey($privKey, 'optional_passphrase');

2) Use in the openssl_sign:
openssl_sign($dataToSign, $signatureVar, $pKeyId);

If you’re using PHP-DKIM class based solution (object oriented), you may put the below code in the _construct() of the main class:

public function __construct()
$fp = fopen("/path/to/file/.htkeyprivate", "r");
$privKey = fread($fp, 8192);
$pKeyId = openssl_get_privatekey($privKey, 'optional_passphase');

$this->open_SSL_priv = $pKeyId;

Hope this helps you. I will definitely try to write again whenever I get time. Theres a lot to share from regular development experiences but time has bound me.

Happy Blogging!

Create Short URL using our URL Shrinker at RUPOM.NET

Today we have released a free URL Shrinking service at which creates shortest possible URL from your long URL input. As the usage of internet is increasing on and people being connected to each other using social networks and social medias as well as the usual options like email, personal website, blog, etc., the necessity of a good and short URL has been very important.

For example: I have been a proud father recently and created a blog post in my blog which is available at Now I want to share this link with friends & family members but it is too big to remember or memorize for anyone. So I went to and created a short URL (I used “fatherhood” in the keyword field) which is very easier to remember/memorize. You click on this link and find the correct destination URL There are more places this short URL can be used especially in where you can’t write more than 140 characters in your post.

RUPOM.NET creates shortest possible URL for you that never expires. If you want to use this service from within your website, you can easily do so using our API help or our HTML form code.

To protect spammers, we have set a time gap of 15 seconds between two consecutive requests from an IP address. But still if you need more facilities, please feel free to contact with us. Also, facilities to track your stats can be provided upon request.

Please start using our URL Shrinking service today and send us comments/feedbacks.


Some helpful Firefox add-ons for web developers

I want to share some helpful Firefox add-ons that you might like. In my case, they all help me a lot in my development.

Helpful Firefox add-ons:

Firebug: Firebug integrates with Firefox to put a wealth of development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

See more info:

Firepicker: Simple color picker plugin for Firebug.

See more info:

Live HTTP Headers: View HTTP headers of a page and while browsing.

See more info:

Quick Java: Allows quick enable and disable of Java and Javascript from the status bar.

See more info:

SEO Live YSRank: Live search rank at the status bar, top searched keywords and search volume data for a specific site. Great for search marketing, keywords research and SEO.

See more info:

IE Tab: This is a great tool for web developers, since you can easily see how your web page displayed in IE with just one click and then switch back to Firefox.

See more info:

Validator: This addon for Firebug will send the current HTML source to and display any errors that are returned by this service.

See more info:

View Source Chart: This add-on:
* Graphically Displays HTML Tag Boundaries
* Graphically Defines Tag Nesting Order, Structure and Hierarchy
* Adds Simple and Powerful UI *to* Source Code

See more info:

CSS Reloader: CSS Reloader is an extension that allows you to reload all the CSS of any site without you have to reload the page itself. You can use the keyboard shortcut F9, or the context-menu’s option “Reload CSS” to reload the CSS files or at page.

Very useful especially when you do pixel pushing.

See more info:

FireFTP: FireFTP is a free, secure, cross-platform FTP client for Mozilla Firefox which provides easy and intuitive access to FTP servers.

See more info:

InfoRSS: Displays RSS, Atom, parsed HTML and NNTP feed in a scrolling area in the status bar. Compatible with podcasting RSS which can be downloaded directly. It’s also a good Google email notifier.

See more info:

Link Checker: Check the validity of links on any webpage.

See more info:

RSS Validator: Validates a page using the W3C RSS Validator.

See more info:

Hope this helps. I will share more in future.


Set your own timezone on a shared hosting

If you are a web application developer and had opportunities to work on various client servers around the globe, you may have already experienced the timezone related problems in the server script. This problem comes when the hosting is a shared one and the website runs for a different timezone than the server’s timezone. For example – I am running a website for my local community here in Dhaka/Bangladesh (timezone GMT + 7.00) but my server which is a shared one resides in the United States (say a timezone like GMT – 7). As this is a shared server, the timezone was set by the administrator to their local time. So every call to PHP date() and/or time() function will always return the server’s local time causing a mismatch with my local time in my website.

To overcome this situation, you have to change your default date time using PHP function date_default_timezone_set(your_time_zone_string). For my case, it was following:


Add this line before executing/calling any date and/or time functions.

Below might be a quick test for you:

echo 'OLD Time: ' . date('Y-m-d H:i:s a');


echo '<br />';

echo 'New Time: ' . date('Y-m-d H:i:s a');

That’s it.

Read more on function date_default_timezone_set:

See the list of supported timezones here:

Happy PHPing!

Google Base Data API Error – You must specify an id for this item

For those who have recently faced this error during product uploading to Google Base, please note that you have to add an additional attribute <g:id> with each of your entries. Google has recently added more documentation on this:



Class Text Search Replace : New Update

Today I made an update of my class “Text Search Replace” at This update will increase the search capability of the class. The initial release of the class could not search some special characters (well, I just forgot & missed this to put with the initial release). Later a user of this class (his name is “Robert”) noticed the problem and asked me for a solution. I was too busy to touch the class. But I managed time and fixed it. You can now work with special characters(especially the ones are part of regular expression syntax). I am sure this fix has increased the usability of this class to a large extent.

Please download the latest version from here:

Special thanks to Robert who noticed and informed me about the problem.

If you are a user of this class, please send me bugs, etc so I can work to improve its performances.


Hello AOL Address Book Grabber Seekers

For AOL address book grabber seekers:

I am getting a lot of requests of “AOL Address Book Grabber” PHP code. For your information – please don’t send me emails. Instead, please fill the following form:

I am a very busy guy and don’t have time to reply to all emails separately. So I thought I would collect interested emails using this form and then reply to the emails on each Saturday. I understand your need and importance of time, but I am sorry I can’t manage time except Saturday.

You may ask why I am not putting a download option of the code. I would like to reply I am sorry I have problems.

Best regards.