Setting up a PHP decent development environment
After years of spaghetti code (I’m Italian, I do really know what spaghetti are) I’m trying to set up a decent php development environment.
This is my battleplan:
- install git and docker on my laptop;
- create a docker virtual enviroment as much similar as possible to
the production LAMP (shared) server;
- use sshfs to mount the docker VE web server root directory on my laptop;
- on the laptop, init a git repository inside the mount point;
- use my favourite ide (aptana studio) to create a php project in the mount point directory;
- test the code pointing a browser to docker VE ip;
- set up a bitbucket account to automatically deploy git commits on production server.
What do you think about? Any chance it could work?
One Solution collect form web for “Setting up a PHP decent development environment”
I suggest using the official php language docker image:
This enables you to create an image that packages your php code, rather than having to map volumes at run-time.
Example 1 (with Dockerfile)
├── build_and_run.sh ├── Dockerfile └── src └── index.php
FROM php:5.6-apache COPY src/ /var/www/html/
Script that builds a new container image and launches it:
docker build -t my-php-app . docker run -it --rm --name my-running-app -p 8080:80 my-php-app
Apache is configured to listen on port 8080
Example 2 (without Dockerfile)
The php image can also be run without a docker file. Just provide a mapping to the source code locally:
docker run -it --rm --name my-apache-php-app -v "$(pwd)/src":/var/www/html -p 8080:80 php:5.6-apache