1

I have this PHP code:

define('DB_SERVER', 'localhost:3306');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', 'viadonau');
define('DB_DATABASE', 'vinoservice');
echo DB_SERVER ;
echo DB_USERNAME;
echo DB_PASSWORD;
echo DB_DATABASE;
$link = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

I alway get a fatal error and i dont know why....on mysql workbench i can connect to the database...and in PHPStorm i can also configure the data source and i can run a query but in php i cant connect. Thanks for help!!!

seherez
  • 31
  • 8

1 Answers1

1

If you create a new PHP file and add the following to it, it should show if MySQLi is enabled or not.

<?php phpinfo(); ?>

If you don't have MySQLi then it will show up with no mysqli

If you do have it, it will show mysqli

You can install the MySQLi extension through terminal by using the following, if on PHP5

apt-get install php5-mysqli

However if you use php 7 use

apt-get install php7.0-mysqli
Ian
  • 3,539
  • 4
  • 27
  • 48
stren-12
  • 57
  • 2