Setting up Azure MySQL with CodeIgniter by having SSL enforced

Introduction

In my previous post I talked about integrating Azure MySQL with a PHP webapp. Today we’ll elaborate on that one a bit further and see how we can setup CodeIgniter to use the Azure MySQL.

 

Prep the webapp

First thing, set all your database variables as app settings (read: environment variables) ;

That’s it as preparation 😉

Continue reading “Setting up Azure MySQL with CodeIgniter by having SSL enforced”

Advertisements

How to integrate Azure MySQL with PHP (on an Azure Webapp)

Introduction

When you deploy a MySQL in Azure, you should know that by default this enforces the usage of SSL on your connection.

And this is for due reason! You really do not want to create your database connection unencrypted. Though this is something that comes as something new to most PHP deployments, so let’s take a look at how to tackle this!

Continue reading “How to integrate Azure MySQL with PHP (on an Azure Webapp)”

Azure : Using PHP to go all oauth2 on the management API!

Introduction

As a hobby effort, I wanted to create a small poc where any user would be able to login with their AAD user, grant access to an application, after which that application could query their subscriptions.

In all honesty, I’ve been struggling more than I like to admit with getting this working… So this post will cover all the steps that you need to do to get this working!

 

Oauth & Azure AD

Before getting our hands dirty, read up on the following post ; Authorize access to web applications using OAuth 2.0 and Azure Active Directory

Ready it thoroughly! To be honest, I didn’t at first and it cost me a lot of time. 😉

Anyhow, the flow looks as follows…

active-directory-oauth-code-flow-native-app

So basically;

  • We’ll redirect the user to sign-in (and if this hasn’t been done, grant our application access)
  • If all went well, we’ll receive an authorization code
  • We’ll use this code to get a bearer (and refresh) token
  • Next up we’ll use the bearer code to connect to the Azure REST API for getting the list of subscriptions for that user.

Continue reading “Azure : Using PHP to go all oauth2 on the management API!”

Getting PHP syntaxing working in vi on Ubuntu

If you want the syntax highlighting to work with Vim on Ubuntu, then simply install the vim-full package:

sudo apt-get install vim-full

Edit the /etc/vim/vimrc file and uncomment (remove the following line

syntax on

Easy as that… (all you need is a few minutes and a bit of bandwith to download the packages)

PHP Frameworks

This week I experimented with some frameworks to see which would provide me the fastest development track for some hobby projects of mine. When reading this post, bare in mind that I come from a Drupal background (so I’m quite spoiled!)… 😉

Requirements
I had a few requirements that such a framework should have:frameworks

  • User Authentication : This is something almost every application needs in some form. If it was up to me, then this basic functionality should be included within easy framework. This was actually the first reason why I switched to Drupal, I was sick and tired to maintain the user management coding whilest this is a common thing.
  • Good Documentation : I don’t mind learning new things, but they should be very clearly documented. I actually learned php right off the php.net site; hands-on with the user contributed code samples.
  • Easy Setup on a shared hosting : Some frameworks are so high up in the sky that it takes you about an hour just to grasp the concept of how the creators wanted it to be. In my mind, it should just be “extract & go”… This doesn’t mean that it has to be a single directory structure. It’s merely meant towards the frameworks which have a “console-like” application to manage the framework. Not everyone has shell access to their development machine…
  • Active User Community : A big part of the “Fast development track”-motivation lies in code submissions of the community behind the framework. You can borrow the code or you can learn from it… Either way, you’re coding at a much faster pace.
  • Easy Form Support : Forms are a BIG part of every application. We can add some bling to it with “ajax” (hypeword detected!), but it remains a form in it’s bare essence.

My Basic Experience
Now for the ones that I’ve tested… Also I would like to add a word of respect to all the creators of the frameworks. This post is not to bash any frameworks, but just a form to express my experience with testing them all out.

Continue reading “PHP Frameworks”