- Hands-On Full Stack Web Development with Angular 6 and Laravel 5
- Fernando Monteiro
- 280字
- 2021-07-23 19:18:56
Configuring php-fpm
In order to configure php-fpm, follow these steps:
- 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)
- 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.
推薦閱讀
- CorelDRAW X6 中文版圖形設計實戰從入門到精通
- 物聯網智慧安監技術
- INSTANT PhpStorm Starter
- 新一代物聯網架構技術:分層算力網絡
- 計算機網絡與數據通信
- 互聯網基礎資源技術與應用發展態勢(2021—2023)
- Go Web Scraping Quick Start Guide
- HTML5 Game development with ImpactJS
- 數字調制解調技術的MATLAB與FPGA實現:Altera/Verilog版(第2版)
- CCNP TSHOOT(642-832)認證考試指南
- 光纖通信系統與網絡(修訂版)
- Android UI Design
- Practical Web Penetration Testing
- 算力網絡:云網融合2.0時代的網絡架構與關鍵技術
- 物聯網技術與實踐