Categories
PHP

Moving Your PHP Projects to Vagrant

If you have read my last blog post, I have chosen to use one Linux box to locally develop web applications. In the last post, I discussed how I setup the Python/Django environment. In this one, I’m going to talk about PHP.

As usual, I installed the LAMP server:

I have all my PHP projects in “~/Sites”, I wanted to serve them from there. So removed the www directory.

Then I added my ~/Sites directory as a synced folder to be mounted as /var/www in the linux guest box. www-data is the user and group permission on these directories so Apache has no issues handling them.

My updated vagrant file:

Upgraded PHP to PHP 5.5 and installed PHPMyAdmin:

Updated my /etc/hosts to update the local dev domains to the IP address of the vagrant box 🙂

Categories
Linux Python

Python and Django on Vagrant

Well, this is going to be another straight forward post with loads of shell commands. The background is simple, I love OS X for the many apps it offers but at the same time I always had the joy of developing on a Linux machine. I decided to use Vagrant to have one central box for my projects. I use separate vagrant boxes for complicated projects. But didn’t like the idea of having individual boxes for simple ones.

I work on Python and Django a lot. So in this post I am going to document my setup.

Vagrant File:

# I have assigned a private IP to the box
# I have assigned a hostname to it.
# I am using Ubuntu Precise Pangolin 64 bit as my base box (which I already have added)

Hosts File (/etc/hosts):

After I setup the box, I logged in using SSH:

Now, the usual Ubuntu setup.

Bash Profile in the Ubuntu machine:

# To make the Django built in server available from outside the box I need to run it on 0.0.0.0 so that it listens on all interfaces. So I added a handy alias.

# Added the virtualenv stuff to the profile

Bootstrapping a project:

Now the app would be available on: http://tardis.dev:8000

I also modify the ~/.virtualenvs//bin/postactivate script to cd into the project source directory. Saves time when I hit “workon env_name”

That’s it 🙂

Categories
Bangla PHP Screencast

Debugging & Profiling PHP Apps with xDebug – Bangla Screencast

Video is available in HD