What steps should be taken to enable PHP to access a PostgreSQL database on a Windows XP Pro system?

To enable PHP to access a PostgreSQL database on a Windows XP Pro system, you need to ensure that the PostgreSQL extension for PHP is enabled in the php.ini configuration file. You also need to have the PostgreSQL database server installed and running on your system. Additionally, you will need to install the PostgreSQL client libraries for PHP to communicate with the database.

// Enable the PostgreSQL extension in php.ini
extension=php_pgsql.dll
extension=php_pdo_pgsql.dll

// Connect to the PostgreSQL database
$host = 'localhost';
$port = '5432';
$dbname = 'your_database_name';
$user = 'your_username';
$password = 'your_password';

$conn = pg_connect("host=$host port=$port dbname=$dbname user=$user password=$password");

if (!$conn) {
    echo "Error connecting to database";
} else {
    echo "Connected to database successfully";
}