Skip to main content
troubleshooting

"PHP Fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes) in /path/file.php on line X"

  • October 3, 2022
  • 0 replies
  • 1799 views

Sébastien
Centreonian
Forum|alt.badge.img+8

Please note that the only procedures supported and maintained by Centreon are those published in the official documentation. If you have a question about this article, post it in the comments.


Symptom

 

You get the message “PHP Fatal error:  Allowed memory size of X bytes exhausted (tried to allocate X bytes) in /path/file.php on line X”.

This error message could appear in centreon-error.log after an update or an upgrade.

 

These are some issues caused by this error:

 

Solution 1 - EL

 

  1. Run the following command depending on the PHP version:
  • For php8:
    /etc/php.ini
  • Increase this value (256M or 512M for example):
    memory_limit = 128M
  1. Then run this command:
    systemctl restart php-fpm


Solution 2 - DEB

  1. Run the following command depending on the PHP version:
  • For php8.2:
    /etc/php/8.2/fpm/php.ini
  • Increase this value (256M or 512M for example):
    memory_limit = 128M

  1. Then run this command:
    systemctl restart php8.2-fpm

Note: Please adapt the path and command according to your PHP version (/etc/php/8.1/ and systemctl restart php8.1-fpm).

 

See also

https://www.php.net/manual/en/ini.core.php#ini.memory-limit