Reputation: 21
I am a lecturer in computer animation and Post Production and relatively new to PHP. I have really, really tried hard to pick up this subject although I am having a particular issue delivering a unit called Web server scripting, where students are expected to pick up PHP and create a basic CMS and am in need of help.
I am working my way through a huge amount of PHP tutorials (I am not being lazy by posting this, I would genuinely appreciate help as I am struggling immensely), and following advice and guidance from local companies, am working with Microsoft Azure, and Github. Students have had some good success already once their accounts were created, and have already deployed some basic PHP web apps.
Part of the criteria that they are about to attempt however, needs access to a MySQL database. The college I work at often has proxy issues and as such, most localised solutions get blocked and cannot be uploaded, via a command prompt or otherwise. I have been experimenting with Microsoft Azure's in app MySQL database, and this looks like it will work perfectly, however I am having issues writing to it. I have followed many tutorials, and posted this question on MSDN but with little joy :
My Web App connects to the database, and the connection established message appears. I am under the impression that this means I can connect, however if I follow a simple tutorial whereby I have to write a login system, submitting the form does not lead to a validation page or any such event, I simply get a message, 'file upload failed'.
http://loginsystemtestbpc.azurewebsites.net/
this is the URL of the webpage I am trying to get working based on a youtube tutorial. I keep reading about MYSQLCONNSTR_localdb and that this is how I connect, I have tried to change every connection variable I can find to establish the database connection, and this looks like it works, however I cannot then write to the database (which is not in read only mode) and checking the PHPmyadmin database reveals that the account created has not saved and I am left with an error message saying a file can't be uploaded.
Is this specifically an Azure MySQL in app issue (a new features introduced about a year ago), or am I consistently doing something wrong with the environment variable? I am happy to share the github repository if this helps?
Please can anyone advice, simply where to look next or what my next step is, as I am keen on using the Azure in app MySQL with this, it looks great, but I just need to establish the connection and then I can work my way back from there.
Upvotes: 2
Views: 3969
Reputation: 41
You can get the database's credentials by using FTP to navigate to the /data/mysql/MYSQLCONNSTR_localdb.ini
file.
This link also documents the usage of the environment variable:
Announcing MySQL in-app for Web Apps (Windows)
If you are able to connect using the credential but can't write to the database then maybe there is something wrong with your PHP code, turn on PHP debugging and see where the code is failing.
Upvotes: 4