
PHP has a tendency to store past sessions in its cache, to clear the problem add the following to the top of your scripts which have a login prior to execution:
ini_set("soap.wsdl_cache_enabled", "0");
This will clear the cache so that you will not be logging into the wrong Force.com API