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

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.

主站蜘蛛池模板: 滦南县| 宁陵县| 久治县| 泽库县| 双流县| 涞源县| 尼玛县| 攀枝花市| 上犹县| 毕节市| 佳木斯市| 且末县| 柳州市| 修武县| 精河县| 遂昌县| 巨野县| 尼勒克县| 吉木萨尔县| 郴州市| 建湖县| 富顺县| 宁远县| 沁阳市| 闽侯县| 成安县| 亚东县| 炎陵县| 高台县| 绥阳县| 上杭县| 偏关县| 黄陵县| 凌云县| 金山区| 思茅市| 昭通市| 富裕县| 拉孜县| 登封市| 留坝县|