PHP and MySQLi
I don't know if it is simply disabled on repl.it or I am doing something wrong but I cannot connect to my SQL database through my PHP files. This is what I am currently doing:
$DB_SERVER = 'server_here'; $DB_USERNAME = 'username_here'; $DB_PASSWORD = 'password_here'; $DB_NAME = 'name_here'; $mysqli = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME); // Check connection if($mysqli === false){ die("ERROR: Could not connect. " . $mysqli->connect_error); } else { echo '<p>Connected</p>'; }
But whenever I run the page with the connection script I get the following error:
Uncaught Error: Class 'mysqli' not found in my-project-here
Seems debatable whether you can do what you ask. Here is a comment I came across by Googling: https://repl.it/talk/ask/How-do-I-use-a-database-with-the-new-php-server/15708
echo phpInfo();
I've found that$pdo = new PDO(Stuff here);
works but throws an exception because there areNo Drivers Found
and inphpInfo();
under thePDO
section it saysNo Value
for where it is saying if drivers are enabled. Thanks for the help!