Php settings with Docker

Dockerfile

Dockerfile.


FROM php:x.x-fpm

COPY ./php.ini /usr/local/etc/php/php.ini
COPY ./php-fpm.d/www.conf /usr/local/etc/php-fpm.d/zzz-www.conf

First, copy `php.ini``` and `zzz-www.conf```.

Contents of php.ini

I will post the ones that make sense. (Omit the character code)

php.ini


;Display the error content in the browser when an error occurs(On in development environment)
desplay_errors = On 
;Enable the setting to spit out error logs
log_errors = On
;php error log/var/log/php_error.Settings to spit to log
error_log = /var/log/php_error.log

;Value is free
;Memory limit to 256MB
memory_limit = 256M
;Maximum value for POST request
post_max_size = 128M
;Upload file acceptance limit
upload_max_filesize = 64M

;Do not list PHP version in response header
expose_php = Off
;SHA session ID hash algorithm-1(160bit)change to
session.hash_function = 1
;Allowable time until forced termination
max_execution_time = 30
;Maximum number of input variables allowed
max_input_vars = 1000

;PHP file tags<?php ?>Only available and restricted(<? ?>Etc. are disabled)
short_open_tag = Off
;Time zone
date.timezone =TZ you want to set

I referred to this article. Reference article If you refer to a few articles, you can write it by yourself.

Contents of `` `zzz-www.conf```

The file name is this because I want it to be read after zz-docker.conf so as not to overwrite the listen with the official image `` `zz-docker.conf```, so it doesn't matter if it is read later.

zzz-www.conf


listen = /var/run/php-fpm/php-fpm.sock
listen.group = www-data
listen.owner = www-data
listen.mode = 0666

The first line specifies the position of the socket. (Match with nginx settings) The 4th line listen.mode should be set to `0666``` because a permission error will occur if the default `listen.mode = 0660```. Reference on line 4 I'm addicted to using UNIX domain sockets with Nginx + PHP-FPM.

Recommended Posts

Php settings with Docker
Disposable PHP with Docker
Docker autostart settings with wsl2
[PDO → DB connection with docker, PHP]
Lightweight PHP 7.4 development environment created with Docker
Launch MariaDB with Docker
Rails deploy with Docker
Run Pico with docker
Explode Docker with WSL2
Use Puphpeteer with Docker
Operate Emby with Docker
Try WildFly with Docker
Use ngrok with Docker
[Docker] Connection with MySQL
Getting Started with Docker
Install Composer with Docker
Debug the VSCode + Docker + PHP development environment with XDebug.
Pytorch execution environment with Docker
Docker settings and this and that
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
Docker management with VS Code
Set up GitLab with docker
[Vscode xdebug3.0 x PHP x Docker]
Run Rails whenever with docker
Get started with DynamoDB with docker
Spring Boot starting with Docker
Build docker environment with WSL
Version control CocoaPods with Docker
Web application built with docker (1)
I tried BIND with Docker
React environment construction with Docker
Build DynamoDB local with Docker
[Docker] Use whenever with Docker + Rails
Using PlantUml with Honkit [Docker]
[PHP8] Install and use PECL YAML function (YAML parser) with Docker
Rails + MySQL environment construction with Docker
Create a Vue3 environment with Docker!
Node.js environment construction with Docker Compose
Run lambda with custom docker image
Deploy a Docker application with Greengrass
Build Couchbase local environment with Docker
Install java with Ubuntu 16.04 based Docker
Environment construction with Docker for beginners
Run SQL Server with Docker ToolBox
Easily Docker Java applications with Jib
Build PlantUML environment with VSCode + Docker
Try running cloudera manager with docker
Molecular phylogenetics exercise with docker (working)
IP address interfered with Docker bridge
Build environment with vue.js + rails + docker
Read dump file with Docker MySQL
Hello World with Docker and C
General error: 1812 occurs with docker + laravel
Build Rails environment with Docker Compose
Create SolrCloud verification environment with Docker
WordPress with Docker Compose on CentOS 8
Prepare a transcendentally simple PHP & Apache environment on Mac with Docker
[Google Cloud] Getting Started with Docker
[SRE / Docker] Start control with Dockerize
Create Laravel environment with Docker (docker-compose)