Friday 13 March 2020

Mod php vs php-fpm and memory limit

mod php is a module installed with apache2 prefork, meaning when apache2 handles a request, the module is called, resulting a lot of memory consumption. Only recommend in Dev server when you need free phpmyadmin mysql interface.

To check the memory_limit, either create a file info.php with phpinfo() function then open it as webpage or run it to find the memory limit and location of php.ini file.
For mod php, php ini file is located at /etc/php/version/apache2/php.ini.

Change memory_limit to desired amount and then sudo service restart apache2(mod php is a module has to restart apache2)


php-fpm is a separate process that runs on its on. way more memory efficient

to check meory limit use php -i | grep 'memory_limit'
or find the php.ini file in /etc/php/version/php-fpm/php.ini

to find exact location of php.ini file, can also use phpinfo() to check where it is


then restart
sudo service php7.0-fpm restart (php-fpm can restart on its own due to its a separate process)

No comments:

Post a Comment