Whilst setting up the phpipam tool (the one i mentioned in my last post https://phpipam.net/) i decided to use a MySQL PaaS in Azure to host the database part rather than manage MySQL myself - however this proved a little tricky to get working.
Well i say tricky - it just needed the config file amended and then it was fine - however this was not at all obvious - let me explain what happened.
So after loading the software usig the normal yum tooling you then have to link the app to a database via the gui screen below - you have a few options - i chose the last one the manual install
So i click that then follow the steps as described on the screen below - after that i put the login details in the config.php file and then the login button should redirect me to the login page
However that wasn't happening at all and i was just being redirected to the main install screen - and it continued round in that loop with no error message coming out at all.....
So i started to dig into the php code to see what was happening ( i don't know php by the way so i was learning as i went along).
After a lot of trial and error and tracking the code path through i finally came across this piece of code
/* open persistent DB connection */
$database = new database($db['host'], $db['user'], $db['pass'], $db['name'], NULL, false);
if($database->connect_error) { $dbFail = true; }
This connects to the mysql database based on the contents of the config.php file - however if there are any errors all that happens is the value of the dbFail variable is set to true - but no actual errors about what is wrong are displayed.
So i added an extra line based on what i found on google for this kind of thing
/* open persistent DB connection */
$database = new database($db['host'], $db['user'], $db['pass'], $db['name'], NULL, false);
if($database->connect_error) { $dbFail = true; }
/* added by rich */
echo ('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
Now when i run the page i see this " connect error (9002) "
So progress - something to go on. However in this case there is nothing of any use that comes up on google - however based on my experiences with setting up another mySQL PaaS i suspected the username format may be the problem.
So i changed the config file from this
/* database connection details
******************************/
$db['host'] = "mysqlpaas.mysql.database.azure.com";
$db['user'] = "phpipam";
$db['pass'] = "password";
$db['name'] = "phpipam";
to this
/* database connection details
******************************/
$db['host'] = "mysqlpaas.mysql.database.azure.com";
$db['user'] = "phpipam@mysqlpaas.mysql.database.azure.com";
$db['pass'] = "password";
$db['name'] = "phpipam";
After i did that the connect error went away and i'm presented with the proper login screen.
I thought it worth sharing as this different username format for PaaS will likely cause a lot of confusion - i've been trying to find a note that describes this and why it has to be specified this way but not real luck so far.
Hopefully this helps someone else