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
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/
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
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