How to host/deploy a PHP app from local machine to appfog

On the previous post we deployed a wordpress site along with a mySQL service by appfog’s built-in installation process in a very fast way. In this post we will describe the process of deploying again a wordpress site but from our local machine like as our own custom PHP app.

Step A: Sign up in appfog and it will show no app under your account. Just leave the browser. Nothing to to do there now. We will use appfog command line tool to both create and upload the files to appfog.
For that, enter the following command in your Mac OSX terminal

After successful installation of “af” you can write the following command and provide your appfog account detail to login to the service.

Note: “af” requires Ruby 1.8.7 or newer. You should Ruby installed already in your Mac 10.6+ . If any problem occurs or you are using Windows then follow this link to resolve.

Step B: Download WordPress and unzip it in your local machine. Then open the terminal again.
Go to the wordpress directory

Make a wp-config file from the sample one

Edit the config file

Change the following part

to

Save the config file by pressing ctrl+X then Y.

Step C: Now start using the appfog command line tool. Staying inside the wordpress directory, simply write the following command and press enter:

By this command you are creating an app to your appfog account which name will be “wordpress-custom”. Follow the next instruction on the terminal window. It will auto detect your repository/directory as PHP app. Then will ask to select your desired infrastructure. Also will ask the memory reservation size and number of instance you like to dedicate for this app. When it asks the question “Create services to bind to ‘wordpress-custom’? [yN]:” you should input “Y”. Then you should choose mySQL’s number and input it then enter. Just check the following photo of the terminal to know when you will have to stop and finish.

All are done! Go back to your appfog account on the web browser. You should see an app named “wordpress-custom” under your dashboard. Click on it. In the next page click on “Visit Live Site” button and I think you know what to do with a wordpress installation page 🙂

If you want to use a phpmyadmin to manage your DB then create an app and select phpmyAdmin actually follow the last section of the last post

If you want to change any code or file and want to the push the update to live site then simply enter the following command when you are done with changes in your local repository:

2 thoughts on “How to host/deploy a PHP app from local machine to appfog”

Comments are closed.