- 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.
推薦閱讀
- Mastering Node.js(Second Edition)
- 光網絡評估及案例分析
- Spring Boot 2.0 Projects
- 物聯網安全與深度學習技術
- OpenLayers Cookbook
- JBoss EAP6 High Availability
- Hands-On Full Stack Development with Spring Boot 2 and React(Second Edition)
- HCNA網絡技術
- Go Web Scraping Quick Start Guide
- Windows Server 2003 Active Directory Design and Implementation: Creating, Migrating, and Merging Networks
- 互聯網安全的40個智慧洞見:2014年中國互聯網安全大會文集
- Socket.IO Real-time Web Application Development
- Mastering TypeScript 3
- Unity Artificial Intelligence Programming
- 計算機網絡技術及應用