Just to expand slightly.
using php to encrypt a password when it is received prevents the password being compromised if someone with evil intent gets access to the server.
If you want to encrypt the password before it leaves the client, so that no-one can snoop on it, you have a couple of options, of which the most straightforward is to use a HTTPS connection. Using this method, any form data is encrypted as it passes from the client to the server, and is decrypted before your application gets it. So your code can ignore all of this process and just get the plaintext password as normal. It's still good practice to md5 it or something before you save it anywhere.
One word of warning on SSH, naive users can still be caught out by a man in the middle attack. This is where any request which a client sends to you is routed through a third party. This could be a malicious site with a url similar but slightly different to yours, or could be done by a dodgy proxy server.
In the above case, the request goes from the client to third party and from the third party to you. It looks fine to you and it looks fine to the client, but the "man in the middle" could be reading everything which goes on.
More savvy clients can detect this through careful examination of the secre (SSL) cert which is needed for the HTTPS connection.