To log out a user from HTTP authentication using PHP, you can use the header function to send a "WWW-Authenticate" header with a value of "Basic realm=realmName" and a 401 status code.