We’ve already installed Nginx web server, PHP, run wrappers and configure php.ini settings. Next step will be some small improvements on global PHP-FPM configuration and also, additional settings on websites wrappers. Today we will edit /etc/php-fpm/version/fpm/php-fpm.conf file. It’s PHP-FPM main configuration file. Not PHP like php.ini from last chapter, but for FastCGI Process Manager. There is no time for unnecessary descriptions, let’s edit this file.
We already have a configured a Nginx web server and PHP-FPM wrapper. It’s time to change PHP default settings now – default configuration files from Ubuntu or Debian repositories aren’t bad, but we can make them better for our needs. In this chapter we will change only one file, php.ini, which should be located on /etc/php/YOUR_VERSION/fpm/ directory. Of course, fell free to use other settings than proposed on this blog entry.
This post will be very short. We must sometimes generate random password in PHP – for example when users create accounts on our service, or we send them new password after reset. Yes, we can do this in many ways, but most of them are bad solutions – we can create function (or method, class) to generate random string from given range, do it manually and try to make all random. But it isn’t random – it must by real secure, we must use cryptographically secure pseudorandom generator.
Recently I posted an entry related to the installation and basic configuration of the Nginx web server. In this episode, we’ll take care of adding PHP to it. Unlike Apache, we can not use the module for the server (mod_php) because Nginx does not have its native support. However, it is possible to redirect PHP-related requests to a separate PHP wrapper service. For this purpose, we will re-use Ubuntu distribution as well as an additional PPA repository. The entry does not describe the exact configuration of PHP, but only its installation and connection with Nginx – details of additional settings will be raised in the subsequent episodes of the cycle.