What is the recommended way to encrypt passwords in the htaccess file using PHP?

Storing passwords in plaintext in the htaccess file is a security risk as it exposes sensitive information. To encrypt passwords in the htaccess file using PHP, you can use the `password_hash()` function to securely hash the passwords before storing them. This ensures that even if the htaccess file is accessed, the passwords are not easily readable.

$password = 'your_password_here';
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
echo $hashed_password;