Home >Backend Development >PHP Tutorial >Why is `password_verify` Failing: Database Column Size Too Small?
Why is Password Verification Failing with Password_verify?
When using PHP 5.5's password_verify function to validate hashed passwords, you may encounter unexpected false results. This typically occurs when the hashed password returned from your database is too long for the selected column.
As stated in the PHP manual, it is recommended to store hashed passwords in a database column capable of holding 255 characters. If your column is shorter than this, it may truncate the hash, making password verification impossible.
To resolve this issue, verify that the database column storing the hashed passwords can accommodate 255 characters. If necessary, alter the column to expand its size. This should ensure that the hashed passwords are stored completely, allowing password_verify to function correctly.
The above is the detailed content of Why is `password_verify` Failing: Database Column Size Too Small?. For more information, please follow other related articles on the PHP Chinese website!