I have found the problem. You have to use walletpassphrase to enter the second password. Example below:
print_r($client->walletpassphrase('mysecondpassword', '1000'));
Replace mysecondpassword with your actual second password, and the 1000 is the amount of seconds (I don't really get this, just set it to 1000).
Hope I could be of help!