If you can get the password in PHP, then it will be restored ...
The only thing you can do is transfer the password to a "secure" location.
Most hosting companies will offer a separate place where you can place your DB files, etc., and this location will not be accessible through a browser. This is where you need to store passwords.
But they are still on your server, and when someone gets access to your mailbox, they have their own password. (It gets to your PHP, which has a way to decode it, and it has access to a protected file -> it can read it)
Thus, there is no such thing as a "secure password"
The only option YOU have is not to store a PASSWORD for your users, etc. I'm going crazy if I sign up for the service, and they offer to send me my password by email if I forget it. They store it in an “extractable way" and that you have nothing to do.
Where all the hashing and salting comes in. You want someone to be able to access the resource. Thus, you haveh + salt the password and save it in the database for the USER who wants to access the service, and when the user wants to authenticate, you use the same algorithm to create a hash and compare it.
Heiko hatzfeld
source share