1 Resposta
- Mais recentes
- Mais votos
- Mais comentários
1
To solve this issue:
if you're getting a fatal error
eg: "mysqli_connect not defined"
first make sure you have php-mysql installed
if you don't, you can install it using
sudo apt-get install php-mysql -y
or
yum install php-mysql
Note: Connect to hostname "localhost" not your amazon server url
Also make sure that you have port 3306 opened on your inbound rules
to add new rule on your instance
-
goto security groups
-
click create security group
-
add inbound rule
-
select mysql/ (default port 3306 will be selected on port field)
with all that done, make your connection in this way;
<?php $servername = "localhost"; $username = "Shendo"; $password = "*******"; $dbname = "exams"; // Create connection $conn = new mysqli_connect($servername, $username, $password, $dbname); // Check connection if (!$conn) { die(mysqli_error()); } else{ echo"connected!"; //---continue to do other things } ?>respondido há 3 anos
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos
- AWS OFICIALAtualizada há um ano