SlideShare a Scribd company logo
1 of 38
Using PHPwith IBM Bluemix
Vikram Vaswani
July 2017
Vikram Vaswani
Founder, Melonfire
● Product design and implementation with open source
technologies
● 20+ productslaunched for customersworldwide
Author and activePHPcommunity participant
● 7 booksfor McGraw-Hill USA
● 250+ tutorialsfor IBM dW, Zend Developer Zoneand
others
Moreinformation at http://vikram-vaswani.in
Vikram Vaswani
ActiveIBM Bluemix user since2014
● IBM Cloud Champion
● 15+ PHPapplicationson IBM Bluemix
● Stray assist: http://stray-assist.mybluemix.net/
● Invoicegenerator: https://invoice-generator.mybluemix.net/
● ATM finder: http://atm-finder.mybluemix.net/
● Document indexer: https://pdf-keyword-search.mybluemix.net
Codesamplesat https://github.com/vvaswani
Bluemix
● Cloud PaaS
● Secureand scalable
● Pay-per-use
● Multipleprogramming languages
● PHP, Java, Go, Ruby, Swift, ...
● Multipleservices(own and third-party)
● Text to Speech, Object Storage, Spark, Sendgrid, ...
Bluemix
● Serverlesscomputing
● ApacheOpenWhisk
● Integrated continuousdelivery toolchains
● Own and externally-hosted repositories
● Web IDE
● Third-party integrations: Slack, GitHub
● Blue-green deployment and rollback
Bluemix and PHP
● PHPruntimeviaCloud Foundry PHPbuildpack
● Key features
● Choiceof Web servers: Apacheor nginx
● Choiceof PHPversions: PHP5 or PHP7
● Support for variousPHPextensionsand modules
● Support for Composer and custom startup scripts
● Debug logs
PHPbuildpack docsat
http://docs.cloudfoundry.org/buildpacks/php/
Prerequisites
● Bluemix account
● Third-party serviceaccounts(if needed)
● Local PHPdevelopment environment
● CloudFoundry CLI
● Application sourcecode(obviously!)
CloudFoundry CLI installation instructionsat
https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
ConfigurationArtifacts
● Application manifest (manifest.yml)
● Buildpack configuration data(.bp-co nfig/* )
● Dependency manifest (co mpo ser.jso n)
Development Approaches
UsethePHPstarter application asbase
● Deploy thestarter application to Bluemix
● Download thesourcecodeand modify locally
● Incorporatelocal or remoteservices
● Redeploy thefinal application to Bluemix and bind
servicesasneeded
Benefits
● Simple, easy to understand
● Best for first-timeusers
Development Approaches
Start from scratch
● Develop theapplication locally
● Incorporatelocal or remoteservices
● Deploy thefinal application to Bluemix and bind
servicesasneeded
Benefits
● Greater flexibility and customization options
● Best for experienced developers
Development Steps
1.Defineand install application dependencies
2.Configureapplication with local servicecredentials
3.Find and instantiateany remoteservicesneeded for
development
4.Configureapplication with remoteservice
credentials
5.Develop, test and finalize
Deployment Steps
1.Find and instantiateremoteservices
2.Updateapplication to retrieveremoteservice
credentialsfrom Bluemix
3.Defineapplication manifest
4.Push application
5.Bind remoteservices
6.Test application
Development
Development: Dependencies
● Useco mpo ser.jso n to
● Specify thePHPversion
● Declaredependenciesand version constraints
● Useco mpo ser.lo ck to
● Lock your application to specific versionsof
dependencies
Development: Dependencies
Sampleco mpo ser.jso n file:
{
"require": {
"php": ">=7.0.0",
"slim/slim": "^3.8",
"slim/php-view": "^2.2"
}
}
Development: ServiceDiscovery
Find servicesusing theBluemix Dashboard
● 120+ services, IBM and third-party
● Many servicesincludeafreetier
Development: ServiceInstantiation
Instantiatenew servicesusing theBluemix Dashboard
● Leaveservicesunbound for local development
● Obtain credentialsfrom each servicepanel
Deployment
Pre-Deployment: ServiceCredentials
● Availablein Bluemix environment for all bound services
viaVCAP_ SERVICES variable
● Structured asJSON document
Pre-Deployment: ServiceCredentials
Samplecode:
<?php
// if BlueMix VCAP_SERVICES environment available
// overwrite local credentials with BlueMix credentials
if ($services = getenv("VCAP_SERVICES")) {
$json = json_decode($services, true);
$config['db']['hostname'] = $json['cleardb'][0]['credentials']['hostname'];
$onfig['db']['username'] = $json['cleardb'][0]['credentials']['username'];
$config['db']['password'] = $json['cleardb'][0]['credentials']['password'];
$config['db']['name'] = $json['cleardb'][0]['credentials']['name'];
}
Deployment: Application Manifest
Usemanifest.yml to defineapplication attributes:
● Host name
● Application name
● Memory
● Number of instances
● Buildpack
Deployment: Application Manifest
Samplemanifest.yml file:
---
applications:
- name: myapp-[initials]
memory: 256M
instances: 1
host: myapp-[initials]
buildpack: https://github.com/cloudfoundry/php-buildpack.git
stack: cflinuxfs2
Deployment: Buildpack Configuration
● Use.bp-co nfig/o ptio ns.jso n to:
● ConfiguretheWeb server and document root
● Set thePHPversion (if conflict, co mpo ser.jso n getspriority)
● EnablePHPmodulesand Zend extensions
● Use.bp-co nfig/php/php.ini.d/*.ini to:
● ConfigurePHPsettings
● EnablePHPextensions
● Use.bp-co nfig/httpd/httpd.co nf to:
● ConfigureApachesettings
Deployment: Buildpack Configuration
Sample.bp-co nfig/o ptio ns.jso n file:
{
"WEB_SERVER": "httpd",
"COMPOSER_VENDOR_DIR": "vendor",
"WEBDIR": "public",
"PHP_VERSION": "{PHP_70_LATEST}"
}
Deployment: Buildpack Configuration
Sample.bp-co nfig/php/php.ini.d/php.ini file:
extension=mysqli.so
default_charset="UTF-8"
display_errors="1"
display_startup_errors="1"
error_reporting="E_ALL"
List of PHPbuildpack extensionsenabled by default at
https://github.com/cloudfoundry/php-buildpack/releases/
Deployment: CodePush
● Set API endpoint
cf api https://api.ng.bluemix.net
● Log in
cf login
● Push application
cf push
Deployment: CodePush Results
When aPHPapplication ispushed:
● Theapplication metadataisstored and arouteand record iscreated for it.
● Theapplication assetsareuploaded.
● ThePHPbuildpack isdownloaded and executed.
● ThePHPbuildpack downloadsand configurestheWeb server and PHPbinary.
● ThePHPbuildpack usesComposer to install application dependencies.
● Thestaged PHPapplication ispackaged into a"droplet".
● Thedroplet isuploaded and thestaged PHPapplication isstarted.
Moreinformation at https://docs.cloudfoundry.org/concepts/how-
applications-are-staged.html
Deployment: ServiceBinding
● Bind services:
cf bind-service APP-NAME SERVICE-
NAME
● Set custom environment variables:
cf set-env APP-NAME VARIABLE VALUE
● Restageapplication:
cf restage APP-NAME
Post-Deployment: Debugging
● View logs:
cf logs APP-NAME
cf logs APP-NAME --recent
● Start secureshell session:
cf ssh APP-NAME
Learn moreat http://vikram-
vaswani.in/weblog/2015/03/19/debugging-php-errors-
on-ibm-bluemix/
Demonstration
SampleApplication
● PHP+MySQL application using Slim micro-
framework
● UsesBluemix ClearDB Managed MySQL service
● Usescustomized buildpack configuration
Codeat https://github.com/vvaswani/bluemix-cities
Demonstration Overview
● Cloneapplication sourcecode
● Configurewith local development MySQL database
● CreateClearDB Managed MySQL Databaseserviceon Bluemix
● Updateapplication codeto useservicecredentialsin Bluemix
environment
● Createapplication manifest
● ConfigureCloud Foundry PHPbuildpack
● Deploy application to Bluemix
● Bind ClearDB Managed MySQL Databaseserviceto application
● Test and debug deployment
Questions?
Contact Information
Email:
● vikram-vaswani.in/contact
Web:
● www.melonfire.com
● vikram-vaswani.in
Social networks:
● plus.google.com/100028886433648406825
MySQL/PHPuser group:
● https://plus.google.com/+mmpugindia/
Using PHP with IBM Bluemix
Using PHP with IBM Bluemix
Using PHP with IBM Bluemix
Using PHP with IBM Bluemix

More Related Content

What's hot

O futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETO futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETRodrigo Kono
 
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...Nuxeo
 
James Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouJames Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouMeet Magento Italy
 
Nagios Conference 2014 - Andy Brist - Intro to Incident Manager
Nagios Conference 2014 - Andy Brist - Intro to Incident ManagerNagios Conference 2014 - Andy Brist - Intro to Incident Manager
Nagios Conference 2014 - Andy Brist - Intro to Incident ManagerNagios
 
DDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by ExampleDDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by ExampleErik Ashepa
 
Inter process communication
Inter process communicationInter process communication
Inter process communicationTamer Rezk
 
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...Nuxeo
 
Content Management and Marketing Automation: Best Practices for Customer Expe...
Content Management and Marketing Automation: Best Practices for Customer Expe...Content Management and Marketing Automation: Best Practices for Customer Expe...
Content Management and Marketing Automation: Best Practices for Customer Expe...Crafter Software
 
Microsoft Azure Cloud Services
Microsoft Azure Cloud ServicesMicrosoft Azure Cloud Services
Microsoft Azure Cloud ServicesRodrigo Kono
 
Micro frontends with react and redux dev day
Micro frontends with react and redux   dev dayMicro frontends with react and redux   dev day
Micro frontends with react and redux dev dayPrasanna Venkatesan
 
Polymer, HTML includes y core-ajax
Polymer, HTML includes y core-ajaxPolymer, HTML includes y core-ajax
Polymer, HTML includes y core-ajaxRadamantis Torres
 
GitLab Remote Meetup: Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...
GitLab Remote Meetup:  Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...GitLab Remote Meetup:  Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...
GitLab Remote Meetup: Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...Nico Meisenzahl
 
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...Nuxeo
 

What's hot (20)

O futuro do desenvolvimento .NET
O futuro do desenvolvimento .NETO futuro do desenvolvimento .NET
O futuro do desenvolvimento .NET
 
What is new in ASP.NET Core
What is new in ASP.NET CoreWhat is new in ASP.NET Core
What is new in ASP.NET Core
 
Get IT together
Get IT togetherGet IT together
Get IT together
 
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
[Webinar] Automating Developer Workspace Construction for the Nuxeo Platform ...
 
James Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouJames Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With You
 
Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015
 
Nagios Conference 2014 - Andy Brist - Intro to Incident Manager
Nagios Conference 2014 - Andy Brist - Intro to Incident ManagerNagios Conference 2014 - Andy Brist - Intro to Incident Manager
Nagios Conference 2014 - Andy Brist - Intro to Incident Manager
 
DDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by ExampleDDD Strategic Patterns and Microservices by Example
DDD Strategic Patterns and Microservices by Example
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...
[Nuxeo World 2013] A DOCUMENT ACQUISITION SOLUTION FOR THE NUXEO PLATFORM - S...
 
Content Management and Marketing Automation: Best Practices for Customer Expe...
Content Management and Marketing Automation: Best Practices for Customer Expe...Content Management and Marketing Automation: Best Practices for Customer Expe...
Content Management and Marketing Automation: Best Practices for Customer Expe...
 
Microsoft Azure Cloud Services
Microsoft Azure Cloud ServicesMicrosoft Azure Cloud Services
Microsoft Azure Cloud Services
 
ORusu_Apps
ORusu_AppsORusu_Apps
ORusu_Apps
 
Micro frontends with react and redux dev day
Micro frontends with react and redux   dev dayMicro frontends with react and redux   dev day
Micro frontends with react and redux dev day
 
Quick workflow of a nodejs api
Quick workflow of a nodejs apiQuick workflow of a nodejs api
Quick workflow of a nodejs api
 
Polymer, HTML includes y core-ajax
Polymer, HTML includes y core-ajaxPolymer, HTML includes y core-ajax
Polymer, HTML includes y core-ajax
 
GitLab Remote Meetup: Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...
GitLab Remote Meetup:  Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...GitLab Remote Meetup:  Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...
GitLab Remote Meetup: Enhance Your Kubernetes CI/CD Pipelines with GitLab & ...
 
MongoDB 2.8 bug hunt
MongoDB 2.8 bug huntMongoDB 2.8 bug hunt
MongoDB 2.8 bug hunt
 
Piwik Presentation
Piwik PresentationPiwik Presentation
Piwik Presentation
 
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...
[Nuxeo World 2013] EXTENSIBILITY AND USE OF NUXEO AS A DOCUMENT MANAGEMENT PL...
 

Similar to Using PHP with IBM Bluemix

How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)Brian Culver
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)Brian Culver
 
Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™IBM
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsPablo Godel
 
Achieving Developer Nirvana With Codename: BlueMix
Achieving Developer Nirvana With Codename: BlueMixAchieving Developer Nirvana With Codename: BlueMix
Achieving Developer Nirvana With Codename: BlueMixRyan Baxter
 
Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Peter Bittner
 
Programmable infrastructure with FlyScript
Programmable infrastructure with FlyScriptProgrammable infrastructure with FlyScript
Programmable infrastructure with FlyScriptRiverbed Technology
 
Simplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual CloudSimplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual CloudLiz Warner
 
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...AgileNCR2013
 
Ahmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDAhmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDShekh Muenuddeen
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Brian Culver
 
Building and Deploying PHP Applications, PHPTour 2016
Building and Deploying PHP Applications, PHPTour 2016Building and Deploying PHP Applications, PHPTour 2016
Building and Deploying PHP Applications, PHPTour 2016Martins Sipenko
 
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScriptENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScriptHoracio Gonzalez
 
Microsoft WebsiteSpark & Windows Platform Installer
Microsoft WebsiteSpark & Windows Platform InstallerMicrosoft WebsiteSpark & Windows Platform Installer
Microsoft WebsiteSpark & Windows Platform InstallerGeorge Kanellopoulos
 
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...Jitendra Bafna
 
Hands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.comHands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.comSalesforce Developers
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and MaintenanceJazkarta, Inc.
 
Firebase Basics - Dialog Demo for Group Tech Staff
Firebase Basics - Dialog Demo for Group Tech StaffFirebase Basics - Dialog Demo for Group Tech Staff
Firebase Basics - Dialog Demo for Group Tech StaffTharaka Devinda
 
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Red Hat Developers
 

Similar to Using PHP with IBM Bluemix (20)

How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
How to convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™Developer Nirvana with IBM Bluemix™
Developer Nirvana with IBM Bluemix™
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
 
Achieving Developer Nirvana With Codename: BlueMix
Achieving Developer Nirvana With Codename: BlueMixAchieving Developer Nirvana With Codename: BlueMix
Achieving Developer Nirvana With Codename: BlueMix
 
Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)Avoid the Vendor Lock-in Trap (with App Deployment)
Avoid the Vendor Lock-in Trap (with App Deployment)
 
Programmable infrastructure with FlyScript
Programmable infrastructure with FlyScriptProgrammable infrastructure with FlyScript
Programmable infrastructure with FlyScript
 
Simplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual CloudSimplifying and accelerating converged media with Open Visual Cloud
Simplifying and accelerating converged media with Open Visual Cloud
 
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
Agile NCR 2013- Shekhar Gulati - Open shift platform-for-rapid-and-agile-deve...
 
Ahmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICDAhmadabad mule soft_meetup_6march2021_azure_CICD
Ahmadabad mule soft_meetup_6march2021_azure_CICD
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Building and Deploying PHP Applications, PHPTour 2016
Building and Deploying PHP Applications, PHPTour 2016Building and Deploying PHP Applications, PHPTour 2016
Building and Deploying PHP Applications, PHPTour 2016
 
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScriptENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
ENIB 2015-2016 - CAI Web - S01E01- La forge JavaScript
 
Microsoft WebsiteSpark & Windows Platform Installer
Microsoft WebsiteSpark & Windows Platform InstallerMicrosoft WebsiteSpark & Windows Platform Installer
Microsoft WebsiteSpark & Windows Platform Installer
 
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...
MuleSoft Surat Meetup#48 - Anypoint API Governance (RAML, OAS and Async API) ...
 
Hands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.comHands-on Workshop: Intermediate Development with Heroku and Force.com
Hands-on Workshop: Intermediate Development with Heroku and Force.com
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 
PHP as a Service TDC2019
PHP as a Service TDC2019PHP as a Service TDC2019
PHP as a Service TDC2019
 
Firebase Basics - Dialog Demo for Group Tech Staff
Firebase Basics - Dialog Demo for Group Tech StaffFirebase Basics - Dialog Demo for Group Tech Staff
Firebase Basics - Dialog Demo for Group Tech Staff
 
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
Putting The 'M' In MBaaS—Red Hat Mobile Client Development Platform (Jay Balu...
 

Recently uploaded

AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIES VE
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 

Recently uploaded (20)

AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 

Using PHP with IBM Bluemix

  • 1. Using PHPwith IBM Bluemix Vikram Vaswani July 2017
  • 2. Vikram Vaswani Founder, Melonfire ● Product design and implementation with open source technologies ● 20+ productslaunched for customersworldwide Author and activePHPcommunity participant ● 7 booksfor McGraw-Hill USA ● 250+ tutorialsfor IBM dW, Zend Developer Zoneand others Moreinformation at http://vikram-vaswani.in
  • 3. Vikram Vaswani ActiveIBM Bluemix user since2014 ● IBM Cloud Champion ● 15+ PHPapplicationson IBM Bluemix ● Stray assist: http://stray-assist.mybluemix.net/ ● Invoicegenerator: https://invoice-generator.mybluemix.net/ ● ATM finder: http://atm-finder.mybluemix.net/ ● Document indexer: https://pdf-keyword-search.mybluemix.net Codesamplesat https://github.com/vvaswani
  • 4. Bluemix ● Cloud PaaS ● Secureand scalable ● Pay-per-use ● Multipleprogramming languages ● PHP, Java, Go, Ruby, Swift, ... ● Multipleservices(own and third-party) ● Text to Speech, Object Storage, Spark, Sendgrid, ...
  • 5. Bluemix ● Serverlesscomputing ● ApacheOpenWhisk ● Integrated continuousdelivery toolchains ● Own and externally-hosted repositories ● Web IDE ● Third-party integrations: Slack, GitHub ● Blue-green deployment and rollback
  • 6. Bluemix and PHP ● PHPruntimeviaCloud Foundry PHPbuildpack ● Key features ● Choiceof Web servers: Apacheor nginx ● Choiceof PHPversions: PHP5 or PHP7 ● Support for variousPHPextensionsand modules ● Support for Composer and custom startup scripts ● Debug logs PHPbuildpack docsat http://docs.cloudfoundry.org/buildpacks/php/
  • 7. Prerequisites ● Bluemix account ● Third-party serviceaccounts(if needed) ● Local PHPdevelopment environment ● CloudFoundry CLI ● Application sourcecode(obviously!) CloudFoundry CLI installation instructionsat https://docs.cloudfoundry.org/cf-cli/install-go-cli.html
  • 8. ConfigurationArtifacts ● Application manifest (manifest.yml) ● Buildpack configuration data(.bp-co nfig/* ) ● Dependency manifest (co mpo ser.jso n)
  • 9. Development Approaches UsethePHPstarter application asbase ● Deploy thestarter application to Bluemix ● Download thesourcecodeand modify locally ● Incorporatelocal or remoteservices ● Redeploy thefinal application to Bluemix and bind servicesasneeded Benefits ● Simple, easy to understand ● Best for first-timeusers
  • 10. Development Approaches Start from scratch ● Develop theapplication locally ● Incorporatelocal or remoteservices ● Deploy thefinal application to Bluemix and bind servicesasneeded Benefits ● Greater flexibility and customization options ● Best for experienced developers
  • 11. Development Steps 1.Defineand install application dependencies 2.Configureapplication with local servicecredentials 3.Find and instantiateany remoteservicesneeded for development 4.Configureapplication with remoteservice credentials 5.Develop, test and finalize
  • 12. Deployment Steps 1.Find and instantiateremoteservices 2.Updateapplication to retrieveremoteservice credentialsfrom Bluemix 3.Defineapplication manifest 4.Push application 5.Bind remoteservices 6.Test application
  • 14. Development: Dependencies ● Useco mpo ser.jso n to ● Specify thePHPversion ● Declaredependenciesand version constraints ● Useco mpo ser.lo ck to ● Lock your application to specific versionsof dependencies
  • 15. Development: Dependencies Sampleco mpo ser.jso n file: { "require": { "php": ">=7.0.0", "slim/slim": "^3.8", "slim/php-view": "^2.2" } }
  • 16. Development: ServiceDiscovery Find servicesusing theBluemix Dashboard ● 120+ services, IBM and third-party ● Many servicesincludeafreetier
  • 17. Development: ServiceInstantiation Instantiatenew servicesusing theBluemix Dashboard ● Leaveservicesunbound for local development ● Obtain credentialsfrom each servicepanel
  • 19. Pre-Deployment: ServiceCredentials ● Availablein Bluemix environment for all bound services viaVCAP_ SERVICES variable ● Structured asJSON document
  • 20. Pre-Deployment: ServiceCredentials Samplecode: <?php // if BlueMix VCAP_SERVICES environment available // overwrite local credentials with BlueMix credentials if ($services = getenv("VCAP_SERVICES")) { $json = json_decode($services, true); $config['db']['hostname'] = $json['cleardb'][0]['credentials']['hostname']; $onfig['db']['username'] = $json['cleardb'][0]['credentials']['username']; $config['db']['password'] = $json['cleardb'][0]['credentials']['password']; $config['db']['name'] = $json['cleardb'][0]['credentials']['name']; }
  • 21. Deployment: Application Manifest Usemanifest.yml to defineapplication attributes: ● Host name ● Application name ● Memory ● Number of instances ● Buildpack
  • 22. Deployment: Application Manifest Samplemanifest.yml file: --- applications: - name: myapp-[initials] memory: 256M instances: 1 host: myapp-[initials] buildpack: https://github.com/cloudfoundry/php-buildpack.git stack: cflinuxfs2
  • 23. Deployment: Buildpack Configuration ● Use.bp-co nfig/o ptio ns.jso n to: ● ConfiguretheWeb server and document root ● Set thePHPversion (if conflict, co mpo ser.jso n getspriority) ● EnablePHPmodulesand Zend extensions ● Use.bp-co nfig/php/php.ini.d/*.ini to: ● ConfigurePHPsettings ● EnablePHPextensions ● Use.bp-co nfig/httpd/httpd.co nf to: ● ConfigureApachesettings
  • 24. Deployment: Buildpack Configuration Sample.bp-co nfig/o ptio ns.jso n file: { "WEB_SERVER": "httpd", "COMPOSER_VENDOR_DIR": "vendor", "WEBDIR": "public", "PHP_VERSION": "{PHP_70_LATEST}" }
  • 25. Deployment: Buildpack Configuration Sample.bp-co nfig/php/php.ini.d/php.ini file: extension=mysqli.so default_charset="UTF-8" display_errors="1" display_startup_errors="1" error_reporting="E_ALL" List of PHPbuildpack extensionsenabled by default at https://github.com/cloudfoundry/php-buildpack/releases/
  • 26. Deployment: CodePush ● Set API endpoint cf api https://api.ng.bluemix.net ● Log in cf login ● Push application cf push
  • 27. Deployment: CodePush Results When aPHPapplication ispushed: ● Theapplication metadataisstored and arouteand record iscreated for it. ● Theapplication assetsareuploaded. ● ThePHPbuildpack isdownloaded and executed. ● ThePHPbuildpack downloadsand configurestheWeb server and PHPbinary. ● ThePHPbuildpack usesComposer to install application dependencies. ● Thestaged PHPapplication ispackaged into a"droplet". ● Thedroplet isuploaded and thestaged PHPapplication isstarted. Moreinformation at https://docs.cloudfoundry.org/concepts/how- applications-are-staged.html
  • 28. Deployment: ServiceBinding ● Bind services: cf bind-service APP-NAME SERVICE- NAME ● Set custom environment variables: cf set-env APP-NAME VARIABLE VALUE ● Restageapplication: cf restage APP-NAME
  • 29. Post-Deployment: Debugging ● View logs: cf logs APP-NAME cf logs APP-NAME --recent ● Start secureshell session: cf ssh APP-NAME Learn moreat http://vikram- vaswani.in/weblog/2015/03/19/debugging-php-errors- on-ibm-bluemix/
  • 31. SampleApplication ● PHP+MySQL application using Slim micro- framework ● UsesBluemix ClearDB Managed MySQL service ● Usescustomized buildpack configuration Codeat https://github.com/vvaswani/bluemix-cities
  • 32. Demonstration Overview ● Cloneapplication sourcecode ● Configurewith local development MySQL database ● CreateClearDB Managed MySQL Databaseserviceon Bluemix ● Updateapplication codeto useservicecredentialsin Bluemix environment ● Createapplication manifest ● ConfigureCloud Foundry PHPbuildpack ● Deploy application to Bluemix ● Bind ClearDB Managed MySQL Databaseserviceto application ● Test and debug deployment
  • 34. Contact Information Email: ● vikram-vaswani.in/contact Web: ● www.melonfire.com ● vikram-vaswani.in Social networks: ● plus.google.com/100028886433648406825 MySQL/PHPuser group: ● https://plus.google.com/+mmpugindia/