Saturday, December 13, 2008

Change MySQL Timezone

If your server is in a different timezone, a quick fix is to update the timezone of the server. I did that previously, but that turned out is not enough. I had to change the timezone of mysql daemon too. Here is how I did it:

SET GLOBAL time_zone = 'America/Los_Angeles';

SET SESSION time_zone = 'America/Los_Angeles';

Check it using:
SELECT @@global.time_zone, @@session.time_zone;

Friday, December 12, 2008

shindig and ssl

For our website, we are looking at some gadget/widget frameworks. First thing I tried was shindig from apache.

I had some trouble getting it to work, so I thought I will document the workaround, in case someone else has the same problem.
Note that in the end, the problem turned out to be different versions of openssl in apache and php, but here is how to work around it.

What caused the problem?
I like portable apps. So that whenever I change/upgrade my machine, I just copy my 'dev' directory to new machine, and my whole development environment is avaialble out of box.
I had set up apache and php about 2 years ago. Over time, as I played with various apps, lot of fat was added, not all of which jive together (notably openssl in this context).


So, to try out shindig, I downloaded the package and followed instructions from this site:
http://incubator.apache.org/shindig/#php

I turned on curl and openssl in php.ini, by uncommenting extensions for curl and openssl.

I configured virtal domain shindig.com and then I hit this url in a browser:
http://shindig.com/shindig/php/gadgets/ifr?url=http://www.labpixies.com/campaigns/todo/todo.xml

I got this error message:
Shindig requires the openssl extention, see http://www.php.net/openssl for more info

Without SSL, I got the above message, but with SSL, apache showed alert with this message whenever I tried to start apache.
"The ordinal 3879 could not be located in the dynamic link library LIBEAY32.dll"


I tried various things, but then I didn't really need ssl at this point, so here is what I did. I went into the shindig code, and found that I could work around the problem. Here is how:

In shindig/php/index.php
look for openssl, and change it like this:

//$modules = array('json', 'SimpleXML', 'libxml', 'curl', 'openssl');
$modules = array('json', 'SimpleXML', 'libxml', 'curl');

That's it. When I will need ssl, I will handle that, but for now, I can keep playing with shindig.

Sunday, November 30, 2008

How to change Redhat Linux timezone

Our dedicated server is in CST timezone, so we thought of changing the timezone to PST, where we are. Here are the instructions I followed:

#timeconfig

This is a visual way of setting the timezone, but I am not sure if it actually did anything.


So, I tried manual way by following these steps:
#mv /etc/localtime /etc/localtime-old
#ln -sf /usr/share/zoneinfo/US/Pacific /etc/localtime
#rdate -s time.nist.gov

Because of our server firewall, the above step timedout. So I tried the following, which timed out too:
#ntpdate pool.ntp.org

So I set the time manually, and then synced the hardware clock:
#date -s "3:38"
#hwclock --systohc --utc
#hwclock --show

Thursday, November 20, 2008

Redmine - email notification auth error

If you want to set up email notification and you are get the following error

504 5.3.3 AUTH mechanism LOGIN not available

Edit your config/email.yml
and comment out the authentication line:
#authentication: :login

Also, I found that for address value, localhost didnt work. I got the following error:
getaddrinfo Name or service not known

So either add entry for localhost 127.0.0.1 in hosts,
or what I did was just specify address value as:
address: 127.0.0.1

Thursday, November 13, 2008

cakephp - ignoring tmp from subversion

Some files like contents of tmp need to be ignored from versioning system like subversion.

I was being lazy, so instead of figuring it out, I did a google search and found this blog post that does exactly that:
http://pjhile.com/ignoring-cakephps-tmp-directory-with-subversion#comments

Basically, here is the command I used from that post:
svn propset svn:ignore 'tmp' .
svn ci -m 'Ignoring "tmp" directory.'

Wednesday, November 12, 2008

mod rewrite and virtual hosts (and displaying html in post)

So we are using cakephp, which uses mod rewrite. I am still very new to cakephp, and have mixed feelings.

Anyhow, I spent about an hour trying to figure out why cake php didnt work when we pushed our first version to QA server. So I hope this saves someone an hour.

I narrowed it down to simply mod rewrite was not configured correctly.

Further digging proved that I have to put a 'directory' directive too if I am using virtualhost. That did the trick.
So here is what my working virtualhost looks like:

<virtualhost>
DocumentRoot /usr/local/qa/app/webroot/
ServerName qa.example.com
ErrorLog logs/qa-error_log
CustomLog logs/qa-access_log common
<directory>
AllowOverride All
</directory>
</virtualhost>


As a PS, just in case if wondering: to display html in a post, I replaced <, > with html lt and gt respectively.

Tuesday, November 11, 2008

typos or errors in apache conf file

While editing the conf files, I always used to restart/reload the config, then go to error log to see the line number with typo/error; I found that there is a simpler way
apachectl -t
(can also take -f file-name)

Monday, November 10, 2008

Charter

I am going to use this blog to document little things I learn here and there as a CTO and cofounder of an early stage technology startup.

Mostly it will have things about technology that took me few hours to figure out, but its not limited to anything in specific.

This blog is also to reach out to other entrepreneurs out there.