Quick tip: increase PhpStorm memory limit

I use PhpStorm as my standard IDE in work. Why? I think it isn’t necessary to describe all advantages – it’s very good software, appreciated and recommended by many, many developers from whole world. PhpStorm can increase our productivity, we can work very fast with code inspection, integrated version control, debugging, testing and many, many other things. But PhpStorm is not perfect. It can be slow if we work with bad or low quality code – mix of not only PHP but also HTML, CSS and JavaScript in one file. With active default inspections and a lot of lines, it can be slooow and require more memory.

Continue reading “Quick tip: increase PhpStorm memory limit”

PHP-FPM – config improvements

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.

Continue reading “PHP-FPM – config improvements”

Nginx and PHP – configure php.ini 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.

Continue reading “Nginx and PHP – configure php.ini file”

PHP – generate secure password

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.

Continue reading “PHP – generate secure password”