Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.

Using PHP and MySQL with IIS and Visual Studio and MS Azure

Tags: php, iis, windows, visual-studio

Install PHP

  • IIS > Get new web platform components > Web Platform Installer opens > Search PHP
  • Add and install PHP 5.6.0, PHP Manager for IIS,

Turn on CGI

  • Programs & Features > Turn Windows features on or off > Internet Information Servers > World Wide Web Services > Application Development Features > CGI

Create an IIS Website

  • IIS > Websites > New Website > Point it at the wwwroot
  • Set ACL for the wwwroot so IIS can access it.

Access DB via MySQL Workbench

  • Get ClearDB connection string via Azure Website Dashboard > View Connection Strings
  • Setup New Connection in MySQL Workbench by parsing the cx string as follows:
    • Hostname –> Data Source
    • Port –> 3306
    • Username –> User Id
    • Password –> same
      • Important: Clear the value before changing the password,
      • otherwise, the Workbench will use the cached password.
    • Default Schema –> Database
  • You can now connect and manage the DB

Backup DB  via MySQL Workbench

  • Open the database connection.
  • Open the Sidebar with View > Panels > Show Sidebar
  • On the Sidebar, choose the Management tab.
  • Under Management, choose Data Export
  • The Data Export dialog will open.
    • Under "Select Database Object...", choose your database.
    • Under "Options", choose Export to Self Contained File (for wholesale restore)
    • Choose the location of your export (the default is /Documents/Dumps)
    • Click "Start Export"

Connect to the a Local MySQL Server

Drop/Import Database from MySQL Workbench

  • Drop. Connect to a MySQL Server. Then File > New Query. Then run DROP DATABASE <database-name>;
  • Import/Restore. Connect to a MySQL Server. Then View > Panels > Show Sidebar. On the Sidebar, choose Management > Data Import/Restore
    • Import from Dump Project Folder OR Import from Self-Contained File
    • Browse to the file. E.g.
      • OneDrive\
      • Documents\
      • BigFont\
      • Clients\
      • 2014-123ST\
      • backups\
      • studio-tour-website\
      • mysqlbackups\
      • ssstudio_wp-2014dec16.sql (this is a Self-Contained File)
    • Click Start Import