PHP MySQL is not connecting... Here are the specs: Apache/2.2.15 (Unix) mysql Ver 14.14 Distrib 5.5.39, for Linux (x86_64) using readline 5.1 PHP 5.4.33 (cli) php-mysql for this version is loaded.
Briefing: This is a fresh Lamp install. I can connect to the database using SSH commands. The user I am trying to connect with has all permissions granted to the database I'm connecting to. Logging in using SSH with that user password from SSH works fine. I can access the database and select from tables.
When I try and connect from PHP I get cannot login to database.
Additional information: there is no domain pointing to the server. I have a virtual host setup in apache and I'm using my local host file to act as the DNS to access the server.
Any ideas?
Added:
<?PHP
$mysqli = new mysqli("localhost", "myuser", "mypassword", "mydatabase");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
?>