Archive for February, 2008

Blogging or copying?

Friday, February 29th, 2008

A blog is an online personal diary.. A personal diary should be filled with information what we have gathered in our own writing… Do you need to use your diary for filling others thoughts and feelings?

Great bloggers are the ones who express what they are master in it , say a finance expert writing his views on economy, his interpretations.. If you cant express things in your own words, a blog is not for you !!

Do you need a blog to copy paste what others have written or uttered ??

This approach is absolutely wrong, unless you express the same in our own way/easily understandable manner, with some extra information/interpretation, copying articles on internet and publishing in ones own blog is stupidity at first point next to legal issues, search engine copy content penalities etc..

Please read my disclaimer before posting opposite arguments.

How to change root password in mysql ?

Wednesday, February 27th, 2008

You might have installed mysql and would like to change / set password for root. Password for root might be empty initially.. So this is what you need to do.

There is a mysqladmin command in unix,linux,freebsd to administer mysql.

Setting root password for mysql for the first time

Here the initial password is empty. Type the following comman.

mysqladmin -u root password YOURNEWPASSWORD

Here YOURNEWPASSWORD is the password you would like to set.

Alternatively, on command line, log in to mysql as root. This time password is not required. Then run an update query to update the password of root.

mysql -u root

update mysql.user set password=’NEWPASSWORD’ where user=’root’

Changing root/user password

Run the following command to change password for root. Replace root with the user name of other users in order to change their password.

mysqladmin -u root OLDPASSWORD NEWPASSWORD

OLDPASSWORD is old password and NEWPASSWORD is the new password.

Alternatively you can run the above query to modify the user password (see above).

XAMPP an easy LAMP installation solution

Monday, February 25th, 2008

Earlier I had messed up my LAMP test server trying to upgrade PHP from 4 to 5 and it was a real headache till I got everything to work..

Someone asked me a question – is there a simple way to install everything (Apache, MySQL PHP with necessary modules) in one shot without configuring each and everything manually.. I had no clue that time but I understood that there is a solution for this..

Just browsed http://www.apachefriends.org/en/xampp.html and found proof that there is a solution available.

Have you tried this? I have to mess up my server again if I have to test this ;) So let me see when time permits :) :)

[Update] There wasn’t mysql enabled on PHP5 when I installed RHEL5 afresh. So I had to remove the rpms of PHP, stop httpd,vsftpd and mysqld forever. Installed XAMPP and everything is working perfectly now..

There is a bit of security issues in XAMPP (Not so big if you take care). So read their documents properly.

PHPIDS – PHP Intrusion Detection System

Tuesday, February 19th, 2008

For those who are concerned about the security of their PHP powered websites, do not forget to check http://php-ids.org/ . I found this website today and I am too a newbie to this.. Looks great.. Will try and post my feedbacks.

Meanwhile do check http://www.alt-php-faq.org/local/115/ which guides you to fight the spammers out. I had posted earlier regarding the same at Protect your Web Forms from email header injections , but here is the URL for the original article.

Iframes and SEO – Do google index iframes ?

Tuesday, February 19th, 2008

Do google index iframes?

Well my experience says it does.. We had an adserver which used to serve ads in an iframe into our websites. One fine day our System admin noticed that a page from our internal ip in google’s index.

Digging on to the above, we found that it was the page which was shown in other sites within iframes. There was no other way google could have indexed our page !!

Any other arguments? Shout here.. We will get into a strong conclusion !! :)

PHP Charts – Free SWF/Image Charting tools

Monday, February 18th, 2008

I was researching some ready built charting libraries for displaying charts in PHP.

Following are the ones I found interesting and good ones to try..

http://quimby.gnus.org/circus/chart/chart-manual.php – This one is a very lightweight charting library which creates image charts.

http://www.maani.us/charts/index.php?menu=Download – With this one you can display dynamic charts in flash (requires flash player at client system)

http://www.aditus.nu/jpgraph/ – This is another charting library with lot of features with support for PHP4 and PHP5. Its not so light as the download size is about 4.5 MB (Yet to try this one due to this reason)

If you know/have used any other good PHP charting libraries, please shout here !!

500 OOPS: cannot change directory: FTP error

Thursday, February 14th, 2008

Hmm.. I had got the above error from vsftp.

I googled around for some time and got some info on getting through this situation.

I just ran following command at shell..

/usr/sbin/setsebool -P ftp_home_dir 1

This worked for me, what about you?

Fatal error: Call to undefined function mysql_connect() !!

Wednesday, February 13th, 2008

I was about to start using my first program on PHP5, then I received this irritating message.

I was using PHP4 these days, so this error was something which revisited after a long time. In PHP4 I new what it means and how to rectify.

The error indicates that PHP was unable to connect to the MySQL DB and it is basically an error on the PHP installation/ missing library file.

Generally, one need to check following things in order to troubleshoot the current situation.

Is it PHP5 on which this error happened and are its after you migrated to PHP5? If then, one small peiece of information for you. MySQL support is not enabled by default in PHP5. You can read http://in.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5 for the reasons and how to troubleshoot.

Following are some other basic troubleshooting steps.

Windows System

  1. Make sure in your PHP.ini file , the mysql extension is enabled. Look for a line containing ‘extension=php_mysql.dll’ and if there is a semicolon in front of this, its not enabled. So remove the semicolon to enable it.
  2. Check for the extension directory path in php.ini – ‘extension_dir = “C:\Program Files\PHP5\ext”‘ . make sure the path is correct, and you have the extension files in it. For mysql extension, you will need php_mysql.dll .

With this much, if mysql is present, you should not be seeing the error message again

Linux System

Make sure PHP is compiled with mysql support. Check http://in.php.net/mysql on the installation instructions.

If you are using PHP5 , mysql is not enabled by default :( (This is where the problem starts). So if you have PHP already installed, consider removing it and recompiling from the source with mysql support.

There are easier methods to set up LAMP systems. Please checkĀ  my post about XAMPP too