Guest User

Untitled

a guest
Oct 30th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?php
  2. // $servername = cpanel->server information->shared ip address
  3. $servername = "example.com";
  4.  
  5. // username used to connect to cpanel
  6. $username = "user";
  7.  
  8. // password used to connect to cpanel
  9. $password = "pass";
  10.  
  11. try {
  12. $conn = new PDO("mysql:host=$servername;dbname=database_name", $username,
  13. $password);
  14. // set the PDO error mode to exception
  15. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  16. echo "Connected successfully";
  17. }
  18. catch(PDOException $e)
  19. {
  20. echo "Connection failed: " . $e->getMessage();
  21. }
  22. ?>
Add Comment
Please, Sign In to add comment