• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

phpmysqlpdoxampp


PHP Snippet 1:

$hostName = "localhost";
$dbName = "test";
$userName = "test";
$password = "test1";
try {
    $pdo = new PDO("mysql:host=$hostName;dbname=$dbName",$userName,$password);
    $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully"; 
    }
    catch(PDOException $e)
    {
     echo "Connection failed: " . $e->getMessage();
    }

Related Snippets

How to increase the PHP upload limits [duplicate]

How to make autocomplete work in foreach php loop? (vscode, intellisense)

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Parameter is not sent to Laravel route in Ajax

Inserting Country Selection into MySQL PHP [duplicate]

mysql slow on updates for a well optimized query

I need to link Google Sheet with my Laravel

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Match single unknown parameter php (Morse-code Regex)

How in Laravel run JavaScript code stored in php variable?

Refresh specific HTML content that retrieves data from MySQL

PHP: PDO + CSV export not downloading (headers issue?)

Form Validation and Submission to database

Get data from accuweather api url

About Contact Privacy policy Terms and conditions