Build PHP Development Environment quickly with PuPHPet

puphpet-logoIf you are a PHP Developer, you might find out that different development environments often create too many problems to the development work. There might be bugs which was not appeared in Windows machines but in Linux. There are also many bugs relating to different PHP versions, PHP modules, web server versions, etc. This quick post give you some resources to build PHP development environment quickly with PuPHPet.

If you already faced with the above problem, you might also think about a way to share development images in the team. It is also a good idea, and it is really feasible with the help of vagrant and virtualbox. The only problem is that it needs learning curve for these, especially with vagrant syntax. So, if there is a way to click-to-configure, it is great. So, it is the game of PuPHPet.

I do not intend to rewrite the full instruction here, since there are many articles such as Build Virtual Machines Easily with PuPHPet Part 1 and Part 2. You can also understand how PuPHPet works easily by visiting its website. This quick post is just a note for you that there is such great tool 🙂

Troubleshoots

1. Permission for some writable synchronized folder in website:

There’s a constraint from VirtualBox on vagrant that does not allow you to set permissions for the synced folder from inside the guest OS. So there are several ways that we can overcome this:

  • First, we can set sync permission from Vagrantfile: http://serverfault.com/questions/398414/vagrant-set-default-share-permissions[bash]config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"][/bash]
  • OR, we can change the webserver user to vagrant in puppet manifest file:[bash]exec { "change_httpd_user":
    command => "sed -i ‘s/www-data/vagrant/g’ /etc/apache2/envvars",
    onlyif => "/bin/grep -q ‘www-data’ ‘/etc/apache2/envvars’",
    notify => Service[‘apache2’],
    require => Package[‘apache2’],
    }

    file { "/var/lock/apache2":
    ensure => "directory",
    owner => "vagrant",
    group => "vagrant",
    require => Exec[‘change_httpd_user’],
    }[/bash]

    . Change apache2 to httpd if using CentOS as guest machine. OR we can change it in the /etc/httpd/conf/httpd.conf

Leave a comment

Your email address will not be published. Required fields are marked *