The PHP version is not the problem here, as of PHP 5.3 "old" MySQL passwords are not supported anymore. Probably two different permission profiles are applied. Are you connecting to the same server? Then something like this could be happening:
User Host
youruser % (using old-style password)
youruser localhost (using new-style password)
That you are using the same credentials does not necessarily mean that those are referring to the same account or permission profile.