Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function connect()
- {
- return "abc";
- }
- Internal Server Error
- The server encountered an internal error or misconfiguration and was unable to complete your request.
- Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
- More information about this error may be available in the server error log.
- Apache/2.4.18 (Ubuntu)
- [Sat Jan 27 08:27:50.831563 2018] [fcgid:warn] [pid 21420] [client 138.68.73.42:53972] mod_fcgid: read data timeout in 41 seconds
- [Sat Jan 27 08:27:50.834028 2018] [core:error] [pid 21420] [client 138.68.73.42:53972] End of script output before headers: user.php
- class Database
- {
- private $dsn = "";
- private $username = "";
- private $password = "";
- public $conn = null;
- public function getConn()
- {
- return $this->conn;
- }
- public function setConn($conn)
- {
- $this->conn = $conn;
- }
- function __construct($dsn = "", $username = "", $password = "")
- {
- $this->dsn = $dsn;
- $this->username = $username;
- $this->password = $password;
- }
- public function connect()
- {
- try {
- $a = new PDO($this->getDsn(), $this->getUsername(), $this->getPassword());
- $a->exec("set names utf8");
- } catch (PDOException $exception) {
- echo "Connection error: " . $exception->getMessage();
- }
- return $a;
- }
- }
- <?php
- require_once 'database.php';
- require_once '../../config/settings.php';
- // all variables is sets. I controlled thems.
- // dsn, user and pass variables coming from '../../config/settings.php'
- $db = new database($dsn, $user, $pass);
- $db = $db->connect();
- <?php
- require_once 'header.php';
Add Comment
Please, Sign In to add comment