Partager via


Azure: Post a PHP app and MySQL database to Azure!

Using an easy to use tool called WebMatrix 3 you can build Web Apps for Azure that work with Git or Visual Studio.  WebMatrix 3 can be used to install WordPress and other popular open source tools on your Dreamspark Azure Web App.

Sources:

Discussion:

Well, this proves that the Dreamspark Azure offering is capable of hosting web sites that are secured via a MySQL database login process and make a reasonable web app/site.  In this case, we used the Web Matrix and this easy to use tool worked flawlessly.  Let’s take a look at the pictorial:

Select how to start
  • Select “My Sites” if you have created a site before using WebMatrix 3. 
  • Select “New” if you want to use the gallery of complete web systems like Word Press or a basic template
  • Select “Open” if you have been using WebMatrix 3 to build sites

image

Select your Template
  • Select “Template Gallery” for a basic template that you can use to get started
  • Select “App Gallery” for higher level open source Web Apps like Word Press and others
  • Select “Empty Site” for…well an empty site

image

For this example, I selected the PHP Starter Site which is a simple CMS site.  In this example, make sure to use the PHP Starter Site, and it will use a MySQL database.  If you have been following this series, you should have a Web App connected to an empty MySQL database.

image

Select the PHP Starter Site

This is pretty easy, but there is a process that might be mildly confusing.  Select the PHP Starter Site and once the template builds, you will see the following:

image

You can modify the PHP as you need to, but let’s just go with it and move on to publish the site as is.

Publish Your Site

To publish your site from Web Matrix, first go to your web app to get the Publishing Profile.  On your web app you will need to procure the publishing profile, click on the “Get publishing profile”

image

Make sure you know where the publishing profile is downloaded! 

To publish your site, push the publish button and add the publishing profile.image

Once you push the Publish button, you will see the following screen, click on the “Import publish profile”

image

Select the site’s publish settings.  For my Web App the App is named “onetwothree”.

image

The publish settings dialog now opens and you can now publish your site. 

image

There are a few more dialog boxes and when you are done, you will see that the site is being published.

image

You should be able to switch over to you website and see your WebMatrix generated Web App on the Dreamspark Azure. 

Conclusion

Using a simple tool you now have created a PHP Web App with a MySQL database.  The database is created by your script.  In all this is a quick way to get an app into Azure.  There are a number of languages you can use with Web Matrix.

The only negative is that the MySQL database is relatively small, but with a little design it can do quite a bit.  We will begin to explore the elements in the Dreamspark Azure.