Here is an example of a PHP script that connects to a database:

“`php
connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}
echo “Connected successfully”;

// Close connection
$conn->close();
?>
“`

In this example, we are connecting to a local MySQL database with the username “root” and password “password”. We are using the “mysqli” extension to establish the connection.

Note that you will need to replace the values of $servername, $username, $password, and $dbname with your own database credentials.