Giter Site home page Giter Site logo

phpappservicelinux's Introduction

PHP App - Running a PHP-MySQL app on Azure App services for Linux

Git clone this repo on your dev machine

git clone https://github.com/brijrajsingh/phpappservicelinux.git

Go to tables.sql file, this file contains some dummy data that we'll need for our app, import this data (run the script) into a local mysql or an Azure based VM or on an Azure Mysql as service instance.

Make sure you have the LAMP stack installed.

Linux Users - Install the 'tasksel' utility and run it, it should install the apache as well as the mysql for you.

Go to includes/config.php and uncomment these lines and put the relevant connection values

/*$db_host = '127.0.0.1';
$db_user = 'root';
$db_pass = '';
$db_name = 'productsdb';*/

Run your php app, it should look like this

PHP App

Deploying the php-mysql web app on App services for Linux

Go to Azure Portal, click on new and select the SKU - Web app on Linux + Mysql (Preview), alternatively you can also select Web app on Linux (Preview) if you are planning to provision the mysql database separately.

PHP App Service

While creating the Web app instance, select "Configure Container" option and select the Image Source as "Built-in" and select the runtime stack as PHP 5.6

PHP App Service Select runtime stack

You may choose to comment out the database settings we provided before or they will anyways be over ridden when we deploy this code over app service.

Follow the steps given at this link to use Git to upload your code over this new Azure App Service - https://docs.microsoft.com/en-us/azure/app-service-web/app-service-deploy-local-git

Go to Azure App Service -> Settings -> Application Settings -> Connection strings and create a connection string by name 'defaultConnection' and put your connection string here, the connection string should be in proper format as shown here

Database=dbname;Data Source=host;User Id=userid;Password=password

PHP App Service create connectionstring variable

Your PHP App service is ready!

phpappservicelinux's People

Contributors

brijrajsingh avatar

Stargazers

 avatar  avatar Kaylene avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.