Wednesday, November 5, 2014

Setup needed for deploying PHP application in bluemix


1)IBM ID:- Create IBM id if you do not have IBM id.

2)Sign up with bluemix using https://ace.ng.bluemix.net/

3) Create PHP Application in Yii framework:
 
After creating PHP application perform the following steps to deploy the application to bluemix.


4)Download and Install the cloud foundry tool :- From https://github.com/cloudfoundry/cli#installers download the Stable version of cloud foundry tool for the required OS and extract the zip contents. Install the tool with Administrative permission

5)Verify the cloud foundry installation:- After you have installed the cloud foundry tool, open the command prompt with Administrative permission and type “cf –v” to display the the version of cloud foundry tool.

6)Create manifest file :- we need to create manifest file to initialize cloud environment for deploying.Create manifest file in your project file. Below is my manifest file that I created for my project. Note host in the manifest file should be unique.


---

applications:

- name: cbdb

  memory: 256M

  instances: 1

  host: cbdbmyapp


 

To deploy the application

1)Use the below command and point your API

C:/> cf api https://api.ng.bluemix.net

2)Change the directory to project file to be uploaded

3)Login using IBM id and pwd when it promted

4)Type below command to deploy the application on bluemix.  cbdb is my application name that I have specified in manifest file.

$ cf push cbdb

 
5)When you push the application, It displays the progress of upload and when it finally completes, it restarts the application

6)You can test your application like http://Provided_Host_Name.mybluemix.net/

Where Provide_Host_Name is the host name that you have specified in manifest file.
 
If something goes wrong and you want to delete the application on cloud, you can delete the application using command “cf delete cbdb –f”
If your PHP application uses mysql service then you need to perform additional steps to use MySQL service
7)
To check the php errors
Use the commands
cf logs <app_name> --recent 
 

2 comments:

  1. Where do you deploy the framework folder? What is the directory for these?

    ReplyDelete
    Replies
    1. In the directory of the application I created a sub-directory called framework.

      When I uploaded the application, the framework also gets uploaded.

      Delete