Apache php fpm docker

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A docker web server with Apache and php-fpm on top of Alpine Linux for development

License

8ctopus/apache-php-fpm-alpine

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

docker apache php-fpm alpine

A super light docker web server with Apache and php-fpm on top of Alpine Linux for php developers.

  • Apache 2.4.57 with SSL
  • php-fpm 8.2.8, 8.1.10, 8.0.17 or 7.4.21
  • Xdebug 3.2.1 — debugger and profiler
  • composer 2.5.8
  • SPX prolifer dev-master
  • zsh 5.9
  • Alpine 3.18.2 using edge repositories

Note: If you need a fully-fledged development environment, checkout the php sandbox project.

  • php along with the most commonly used extensions
  • Just works with any domain name
  • Support for multiple virtual hosts
  • https is configured out of the box
  • Apache and php configuration files are exposed on the host for easy editing
  • All changes to configuration files are automatically applied (hot reload)
  • Xdebug is configured for step by step debugging and profiling
  • Profile php code with SPX or Xdebug
  • download docker-compose.yml
  • to use php 8.1, 8.0 or 7.4, select the image in docker-compose.yml
  • start Docker Desktop and run docker-compose up
  • open browser at http://localhost/

Note: On Windows hot reload doesn’t work with WSL 2, you need to use the legacy Hyper-V.

Starting the container with docker-compose offers all functionalities.

# start container in detached mode on Windows in cmd start /B docker-compose up # start container in detached mode on linux, mac and mintty docker-compose up & # view logs docker-compose logs -f # stop container docker-compose stop # delete container docker-compose down

Alternatively the container can also be started with docker run .

# php 8.2 docker run -p 80:80 -p 443:443 --name web 8ct8pus/apache-php-fpm-alpine:2.1.0 # php 8.1 docker run -p 80:80 -p 443:443 --name web 8ct8pus/apache-php-fpm-alpine:2.0.5 CTRL-C to stop

There are 2 sites you can access from your browser

http(s)://localhost/ http(s)://(www.)test.com/ 

The source code is located inside the sites/*/html/public/ directories.

Setting a domain name is done by using virtual hosts. The virtual hosts configuration files are located in sites/config/vhosts/ . By default, localhost and test.com are already defined as virtual hosts.

For your browser to resolve test.com , add this line to your system’s host file. Editing the file requires administrator privileges.

On Windows: C:\Windows\System32\drivers\etc\hosts
Linux and Mac: /etc/hosts

127.0.0.1 test.com www.test.com 

A self-signed https certificate is already configured for localhost and test.com .
To remove «Your connection is not private» nag screens, import the certificate authority file sites/config/ssl/certificate_authority.pem to your computer’s Trusted Root Certification Authorities then restart your browser.

In Windows, open certmgr.msc > click Trusted Root Certification Authorities , then right click on that folder and select Import. under All Tasks .

On Linux and Mac: [fill blank]

For newly created domains, you will need to create the SSL certificate:

docker-exec -it web zsh selfsign certificate /sites/domain/ssl domain.com,www.domain.com,api.domain.com /sites/config/ssl

Note: Importing the certificate authority creates a security risk since all certificates issued by this new authority are shown as perfectly valid in your browsers.

This repository is configured to debug php code in Visual Studio Code. To start debugging, open the VSCode workspace then select Run > Start debugging then open the site in the browser.
The default config is to stop on entry which stops at the first line in the file. To only stop on breakpoints, set stopOnEntry to false in .vscode/launch.json .

For other IDEs, set the Xdebug debugging port to 9001 .

To troubleshoot debugger issues, check the sites/localhost/logs/xdebug.log file.

If host.docker.internal does not resolve within the container, update the xdebug client host within docker/etc/php/conf.d/xdebug.ini to the docker host ip address.

xdebug.client_host = 192.168.65.2

Code profiling comes in 2 variants.

Note: Disable Xdebug debugger xdebug.remote_enable for accurate measurements.

To start profiling, add the XDEBUG_PROFILE variable to the request as a GET, POST or COOKIE.

http://localhost/?XDEBUG_PROFILE 

Profiles are stored in the log directory and can be analyzed with tools such as webgrind.

  • Access the SPX control panel
  • Check checkbox Whether to enable SPX profiler for your current browser session. No performance impact for other clients.
  • Run the script to profile
  • Refresh the SPX control panel tab and the report will be available at the bottom of the screen. Click it to show the report in a new tab.

access container command line

install more php extensions

docker exec -it web zsh apk add php82-extension>

Let’s extend this docker image by adding the php-curl extension.

docker-compose up --detach docker exec -it web zsh apk add php-curl exit docker-compose stop docker commit web apache-php-fpm-alpine-curl:dev

To use newly created image, update the image reference in docker-compose.yml .

When you update the docker image version in docker-compose.yml , it’s important to know that the existing configuration in the docker dir may cause problems.
To solve all problems, backup the existing dir then delete it.

docker build -t apache-php-fpm-alpine:dev .
services: web: # development image image: apache-php-fpm-alpine:dev

Note: Only for repository owner

# build php spx module ./php-spx/build.sh # build local image docker build --no-cache -t 8ct8pus/apache-php-fpm-alpine:2.1.0 . # test local image # push image to docker hub docker push 8ct8pus/apache-php-fpm-alpine:2.1.0

About

A docker web server with Apache and php-fpm on top of Alpine Linux for development

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A simple docker file for apache 2.4 and php-fpm 7.0

OpenDataStack/docker-apache-php-fpm

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A simple Dockerfile for apache 2.4 and php-fpm 7.0

  • Based on ubuntu:16.04 for developer simplicity (not size)
  • With apache 2.4 + php-7.0-fpm
  • Custom apache 2.4, php and supervisord configurations
  • Without a database
  • $WWW_UID and $WWW_GID : Optional to change the UID/GID that nginx runs under to solve permission issues if you are mounting a directory from your host
  • This is also designed to work with docker-sync as docker-sync native mac will break if the uid of sync_userid does not exist within the container

Pull from docker hub and run:

docker pull opendatastack/apache-php-fpm; docker run \ -p 8787:80 \ --name apache-php-fpm opendatastack/apache-php-fpm; 
git clone git@github.com:OpenDataStack/docker-apache-php-fpm.git && cd docker-apache-php-fpm 
docker rm apache-php-fpm; docker build -t apache-php-fpm .; docker run \ -p 8787:80 \ --name apache-php-fpm apache-php-fpm:latest; 
docker rm apache-php-fpm; docker build -t apache-php-fpm .; docker run \ -p 8787:80 \ -v "$(pwd)"/src/test:/var/www/html \ --name apache-php-fpm apache-php-fpm:latest; 
docker login docker tag apache-php-fpm opendatastack/apache-php-fpm docker push opendatastack/apache-php-fpm 
docker exec -it apache-php-fpm /bin/bash 

Copy files from the container:

docker cp apache-php-fpm:/etc/php/7.0/fpm/php.ini /PATH/TO/FILE 

About

A simple docker file for apache 2.4 and php-fpm 7.0

Источник

Читайте также:  Learn how to program with java
Оцените статью