-1
To make a connection to the Mysql database use this code in PHP:
$host = "host";
$usuario = "usuario";
$banco = "banco";
$senha = "senha";
$pdo = new PDO('mysql:host='.$host.';dbname='.$banco, $usuario, $senha);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Is there any way to encrypt the password and login? Because the client found this file unsafe with the access data so loose in FTP....
Okay, you want to encrypt the login/password... To encrypt you need a key, where would this key go? You can use environment variable, this removes passwords from code, preventing passwords to be saved in multi-places and also to be saved using
git
(and the like). Another but radical alternative is to create a user using theREQUIRE X509
user. That way, you do not use "login/password", but use certificates (which in any way will have to be setting in some corner).– Inkeliz