GitXplorerGitXplorer
p

docker-php-fpm

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
ad45e191c9fcf2309b08ad7fe9bedca2c9b9f2df

Updated xdebug info

pperiscuelo committed 3 years ago
Unverified
70e8b95d9af1060e8b792fac24f79adb99926005

Updated docs with XDebug info

pperiscuelo committed 3 years ago
Unverified
d77d065f81bf186f17c4b0fc3a61929747602156

Added xdebug option

pperiscuelo committed 3 years ago
Unverified
a39f4df54c1c2c628bd026ade36755cfa0a24c47

Updated to have two versions with and without xdebug

pperiscuelo committed 3 years ago
Unverified
e48d5016dd0babfda5affd4fe6c7cd63fa719998

Updated docs

pperiscuelo committed 3 years ago
Unverified
e0e57d63aefd6c62a0ac12948bcaa37fac0c6085

Change to organize instructions

pperiscuelo committed 3 years ago

README

The README file for this repository.

PHP FPM + Composer + XDebug + PHPUnit

A simple docker configuration to use PHP FPM for development

This is a simple Dockerfile that uses the latest PHP-FPM image. This is suitable for development and testing, not for production.

Requiriments

Have a local folder named htdocs

$ mkdir htdocs

For a test, make a file named index.php and save in htdocs folder created before.

content of index.php

<?php phpinfo(); ?>

And you can create and edit too the php.ini as you need.
Now you are ready for the next step.

Usage

MAC or Linux

$ docker container run -d -p 9000:9000 -v $(pwd)/htdocs:/var/www/ periscuelo/php-fpm

with php.ini

$ docker container run -d -p 9000:9000 -v $(pwd)/htdocs:/var/www/ -v $(pwd)/php.ini:/usr/local/etc/php/php.ini periscuelo/php-fpm

Windows PowerShell

$ docker container run -d -p 9000:9000 -v ${pwd}/htdocs:/var/www/ periscuelo/php-fpm

with php.ini

$ docker container run -d -p 9000:9000 -v ${pwd}/htdocs:/var/www/ -v ${pwd}/php.ini:/usr/local/etc/php/php.ini periscuelo/php-fpm

docker-compose

The php.ini volume is necessary only if you want change something there.

# docker-compose.yml
version: '3'

services:
  php:
    image: periscuelo/php-fpm:latest
    ports:
      - 9000:9000
    volumes:
      - ./htdocs:/var/www
      - ./php.ini:/usr/local/etc/php/php.ini

$ docker-compose up -d

PHP Composer

You can use the composer too. For this, use the following command:

$ docker exec -it ID_OR_NAME_OF_YOUR_CONTAINER bash

You have to replace ID_OR_NAME_OF_YOUR_CONTAINER for the respective Container ID or Container NAME.
Ex: If my container id is f3c99c3239ex then, the command must be:

$ docker exec -it f3c99c3239ex bash

Inside the terminal you can use the composer as you want.
For example:

$ composer create-project phpmyadmin/phpmyadmin

You can use phpmyadmin to made changes in your MySQL Database.
For exit of terminal after, the command must be:

$ exit

And you come out of container.

Enjoy

Put your PHP files in htdocs to access by command. Have fun =)
Do you need to use NGINX with PHP FPM? Follow this instructions.