官术网_书友最值得收藏!

Configuring php-fpm

In order to configure php-fpm, follow these steps:

  1. Inside the php-fpm folder, create a file called Dockerfile and add the following lines:
FROM phpdockerio/php72-fpm:latest
WORKDIR "/application"
# Install selected extensions and other stuff
RUN apt-get update \
&& apt-get -y --no-install-recommends install php7.2-mysql
libmcrypt-dev \
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
/usr/share/doc/*

Now, it is time to create our override php.ini file, which is the PHP.ini where we can manually override PHP settings that run on the server.

In the case of Apache servers, it only runs once when the server is started, in our case, as we use nginx with php-fpm. In regards to this, we are using a fastCgi environment, and this file is read with every server invocation.

Some advantages to using fastCgi environment rather than the traditional Apache evironment are as follows:

  • Adaptive process growth
  • Basic statistics (similar to Apache mod_status)
  • Advanced process management with graceful start/stop
  • The ability to start workers with different uid, gid, chroot, environment, and php.ini (replaces safe_mode)
  • It creates logs for stdout and stderr
  • Emergency restart in case of accidental code destruction (cache)
  • Supports accelerated upload
  • Several improvements to your facet FastCGI

Other ways to use PHP on servers are as follows:

  • Apache module (mod_php)
  • CGI
  • FastCGI
  • PHP – FastCGI Process Manager (FPM )
  • Command lines (CLI)
  1. Inside the php-fpm folder, create a new file called php-ini-overrides.ini and add the following code:
upload_max_filesize = 300M
post_max_size = 308M
[Xdebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=111.111.11.1 # you must use your own IP address here
xdebug.remote_port=9009

Note that we are only setting up Xdebug here, which is a PHP extension to debug PHP applications.

主站蜘蛛池模板: 策勒县| 炉霍县| 凌海市| 安塞县| 炉霍县| 宝清县| 平陆县| 怀安县| 白朗县| 绥江县| 屯昌县| 昌邑市| 鄂托克前旗| 武川县| 梅州市| 吉林省| 错那县| 扎赉特旗| 万州区| 延边| 平和县| 桃园县| 海盐县| 岐山县| 定南县| 柳江县| 阿拉尔市| 财经| 马公市| 清水河县| 隆尧县| 诸暨市| 太仆寺旗| 当涂县| 将乐县| 新沂市| 长泰县| 吉木萨尔县| 开原市| 临汾市| 鸡西市|