heroku-buildpack-php icon indicating copy to clipboard operation
heroku-buildpack-php copied to clipboard

Equivalent for Local Development?

Open rayrigam opened this issue 11 years ago • 1 comments

I'm wondering whether someone has worked out a way to easily set up a local machine for development with an equivalent to this Heroku-PHP Buildpack?

I tried using Vagrant with the following Heroku Celadon Cedar Virtual Box: http://dl.dropbox.com/u/1906634/heroku.box Then set up a bootstrap.sh file with all the shell commands needed to install PHP, Nginx, and other. However, I have trouble installing php as I have not found a pre-compiled PHP 5.5 version for Ubuntu 10.04 (I cannot simply run sudo apt-get install php5 as that would install an older PHP version). I tried using the PHP from http://www.christophh.net/php-build/ but I then run into trouble

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

when building it with php-build -i development --pear 5.5.8 ~/local/php/5.5.8. I can solve that with sudo apt-get install libmcrypt-dev but then I have to tell the system where to find PHP, set php5-fpm and other extensions... Then I have to make sure configuration files are equivalent to those in this Buildpack.

I could probably figure it out with some time, but I was wondering whether there is an easier way (or tutorial) already available?

rayrigam avatar Jan 28 '14 14:01 rayrigam

I used this in development using dokku - https://github.com/progrium/dokku I also used guest additions in vagrant to share the site to a local share. You can then edit code without re-pushing all the time. I've found having the git repo contain a subfolder, then share this subfolder works best. Sorry if this isn't enough detail to replicate, just know it's possible. Also a good gotcha to avoid with this setup is caching, disable opache. See my example composer.json below

{
    "require": {
      "php": ">=5.4.0",
      "ohmy/auth": "*"
    },
    "extra": {
      "heroku": {
      "document-root": "public_html",
      "index-document": "index.php",
      "nginx-includes":["nginx.conf"],
      "php-config": [
        "opcache.enable=off"
      ]
    }
  }
}

crisward avatar Jul 31 '14 19:07 crisward