Yesterday, I configured apache 2.2.3, php 5.2 and mysql 5.0.18. Alright, I know that’s not a big deal. But here are a few things that you must do in order for them to work seamlessly.

httpd.conf:
Add the following 4 lines to httpd.conf so that php will work correctly.

  • LoadModule php5_module /path/to/php/php5apache2_2.dll
  • PHPIniDir /path/to/php.ini (E.g. PHPIniDir “C:/PHP”. Note that the the path doesn’t end with “/php.ini”).
  • AddType application/x-httpd-php .php – This tells apache to handle PHP requests. If you want to add more extensions for php, E.g. say you want to process “.abc” files as PHP, then add “AddType application/x-httpd-php .abc”.
  • Find this line in your httpd.conf “DirectoryIndex index.html” and replace it with “DirectoryIndex index.html index.php”.

php.ini:
Go to the folder where you installed PHP. Open php.ini in your favourite text editor and find the line that says extension_dir = “./”. Replace that line with extension_dir = “/path/to/ext/folder”. Note that, there should be no trailing slash to the value of extension_dir.

my.ini:
Now go to the folder where you installed MySql. Try to start the MySQL daemon. I’m assuming that you haven’t installed MySQL as a service. If the mysql daemon (mysqld.exe) is running, try connecting to it by issuing the command on the command prompt.

“mysql -u <user_name>”

If you get an error like this “ERROR 2003 (HY000): Can’t connect to MySQL server on ‘localhost’ (10061)”, open your my.ini file. Find the line that says “port=3306”. Replace it with a port number of your choice. There will be 2 such lines in my.ini. One is for server and the other is for client. Now try connecting again.

To run the mysql server in verbose mode, instead of just double clicking on mysqld.exe, open command prompt and type “mysqld –console“. This will give you a quick overview of what is happening.

When you run your php scripts that connects to mysql, you should now specify the port number also (if it is not 3306). E.g. $con = mysql_connect(“localhost:4000“, “user”, “password”);

After all these changes, don’t forget to restart your apache server. When you get an error dialog that says that some PHP extensions cannot be loaded, make a note of those extension names first. Now, open your php.ini. Search for “extension=php_”. Above the first extension line, add the missing extension DLLs. E.g. extension=php_pdo.dll etc.

These are some of the gotchas that I faced 🙂 Next I have to try and configure a Mongrel cluster for apache for running ruby on rails apps.

Shifting to WordPress :-)

September 17th, 2007

My dear friends, I’m shifting my blog to wordpress. The blog may be unavailable for a day or two since I’m experimenting a few things. The experiments will definitely be updated on my tech blog.

Just to assure you, my non-tech blog URL (http://blog.aswinanand.com) and its feed URL (http://blog.aswinanand.com/atom.xml) will continue to work as they were :-). Thanks to the magic of mod_rewrite. The same goes with my tech blog also. The existing links http://tech.aswinanand.com and http://tech.aswinanand.com/atom.xml (for feeds) will work as well. That saves you from updating your feed links ;-). In a day or two, I will be updating my feed burner feeds as well.

Shifting my blog to wordpress, writing a wordpress plugin, wildcard domains, htaccess and mod_rewrite… whoa! All that was such a nice learning experience. Will be posting all that over some time on my tech blog.

Thanks a lot to all my readers 🙂

Update: The shift has been completed. The old non-tech blog is at http://aswinanand.blogspot.com/ and the old tech blog is at http://techlight.blogspot.com/.

Lock your bikes when you park

September 16th, 2007

So, you are out shopping in the busy Tnagar area in Chennai and you don’t find a place to park. After struggling for half hour, you come to terms with a small place with enough place only for a rat to sneak in. Somehow managing the difficulty, you park your brand new Bajaj Pulsar 200 cc bike and set off happilly for shopping.

Now, when you return your bike is lost! How come? You start wondering, start crying and even roll on the road. But the bike won’t come back. Here’s why.

Just a few days back, I went to the mechanic shop to repair my bike horns because they were not functioning properly. The guy who repaired was small… say may be 14 years old. He challenged me by saying that he could kick-start my bike without the keys! Man.. I was shocked. After meddling with something below the handlebar, he told me to remove the keys from bike. May be offered a small prayer or something but as soon as he kicked on the starter, the bike came to life. He was beaming, all this 32 teeth showing. He went for a small round and came back!

Now you know how many (if not all) bikes get stolen. Never ever forgot to side-lock your bike. If at all your bike was side-locked, even though starting it is not a problem, riding it IS definitely a problem.

Get it? 🙂

Echo Club

September 13th, 2007

Hi guys, it’s been a long time since I made a post on the blog. I will be back in full swing soon.

But before that, a small news 🙂 I have been writing a few articles on http://thoughts.clubecho.org/. Please do read them and comment on them.

Hi guys, wordpress 2.2.2 has a problem of importing blogger blogs to wordpress. It happens when you get an error saying, “We were not able to gain access to your account. Try starting over.

This problem can be resolved only in custom wordpress installations i.e. you have your own domain on which you have installed wordpress (downloaded from http://www.wordpress.org/).

After login through FTP (Example FTP client is filezilla) to your web hosting provider, locate the folder where you have installed wordpress. In my case, I have installed it in a folder called “blog”.

Locate the folder “wp-admin”. Inside wp-admin, select a folder called “import”. Open the “import” folder. There’s a file called “blogger.php”. Download the file to your computer. Open the file in any of the popular text editors and go to line number 87. It looks like the first screenshot.

[Click the image for a bigger screenshot]

Line number 87 is highlighted in blue. Change “www2.blogger.com” to “www.blogger.com” (Refer to screenshot below). Save the file and upload it to the same folder from where you downloaded it.


[Click the image for a bigger screenshot]

Have fun! 🙂