A web developer’s diary

October 31, 2006

Client does not support authentication protocol;

Filed under: MYSQL — Celia @ 8:58 am

You just bought a nice piece of web software, uploaded it to your site, did some advertising, got some good users, and every thing looks so nice and rosy.

And one fine day, you decide to do upgrade your Mysql and oops, your web application stops working and reports this error.

Warning: mysql_pconnect() [function.mysql-pconnect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client.

I know. It is really irritating to see errors like this. But this is a very simple issue and can be corrected easily. This happens because, Mysql 5 suddenly decided to use a different password hashing algorithm that is incompatible with older clients.

So, what is the remedy? You can choose any one of the following options.

(more…)

October 28, 2006

^M problem in Editors

Filed under: Vim — Celia @ 9:27 am

If you are one of those kinds who shuttle between environments like windows/linux/mac, you would have come across this problem many a times.

You would have just received a file from one of your mac friend and when you open it, you would see the file being elegantly decorated by the ^M character at the end of each line.

Well, its not really the ^M character. This happens when the editors can’t interpret the linefeed characters properly. But we can’t keep living with this character. Can we? But how to replace this to null in the file?

Try out this simple command in the command mode.

:%s/^M$//g

Note: The ^M is not carot M. It is CTRL V CTRL M.

October 20, 2006

Object.returnHTML and Javascript evaluation

Filed under: Ajax — Celia @ 4:02 pm

One of my friends had a doubt and she had mailed me this.

Question:
In one of my pages, I am using ajax to show dynamic content. I am making an ajax call and using the innerHtml to show the content returned. The problem here is, my returned content has some javascript code which has to be executed. But its not. InnerHtml simply writes without executing any js. Is there any function which will execute the js in my content?

I replied to her and at the same time thought that it would be useful to my blog readers as well.

Answer:
Unfortunately, No. While handling Ajax calls and assigning the returned content to returnHTML, the returned javascript does not get evaluated by default. You should explicitly evaluate it. And, how do you do that? Assign an id to your script tag and evaluate the javascript content within this script tag using eval() function.

For people, who think that this is complicated, there are some nice ajax libraries out there like prototype and script.aculo.us. You can use their functions and all you would need to do there is to set a boolean variable called evalScripts to true. Many popular sites like Digg and Tezaa use these libraries.

Let me know if this helped. If you found a better solution, let me know too.

October 12, 2006

OPEN_BASEDIR RESTRICTION IN EFFECT error

Filed under: PHP — Celia @ 6:09 am

When a client was trying to install a script of mine, he got this below error.

Warning: main() [function.main]: open_basedir restriction in effect. File(/script.php) is not within the allowed path(s):

This problem happens mostly on shared networks. The hosting provider would have enabled the ‘open_basedir’ restriction on the server to prevent the user from using php scripts on that particular folder.

In this case, either of the following solutions would work.

1) The host should disable the restriction.
2) Or the host can add the ‘concerned folder path’ to the list of allowed folders.

Once the problem was traced out and fixed, my client was able to install it.

(more…)

October 1, 2006

Out of range value adjusted for column error

Filed under: MYSQL,PHP — Celia @ 7:23 am

This is one bug that had me smitten ever since Mysql 5 was released. If you had encountered this error and are searching in vain throughout google and msn for a fix, please do not be discouraged. This is a very simple problem and can be corrected easily.

1) Use SQL_MODE functionality:

Login to the Mysql shell and give the following command.

SET GLOBAL SQL_MODE=”;

Voila. That fixes your problem.

2) Revert to Mysql 4.

If you are not sure on how to do 1), this is the only other option avaliable.

(more…)

Blog at WordPress.com.