Hostxpeed
Login Get Started →
Control Panel

How to Change PHP Memory Limit in HestiaCP

4 min read
37 views
Jun 12, 2026

Prerequisites

Before changing PHP memory limit, make sure you have:

  • SSH access to your VPS
  • Root or sudo privileges

What is PHP Memory Limit?

Memory limit controls the maximum amount of RAM a PHP script can use. When exceeded, the script stops with "Allowed memory size exhausted" error.

Method 1: Edit php.ini

For PHP 8.2 FPM:

nano /etc/php/8.2/fpm/php.ini

Change:

memory_limit = 256M

Also update CLI:

nano /etc/php/8.2/cli/php.ini

Method 2: Change via .htaccess (Apache)

php_value memory_limit 256M

Method 3: Change via .user.ini (Nginx/FPM)

nano /home/admin/web/example.com/public_html/.user.ini

Add:

memory_limit = 256M

Method 4: Change per Script

ini_set('memory_limit', '256M');

Restart PHP-FPM

systemctl restart php8.2-fpm

Recommended Memory Limits

Use CaseMemory Limit
Basic WordPress/Drupal128M-256M
WooCommerce256M-512M
Laravel, Symfony256M
Magento512M-1G
Data processing512M-2G

✅ PHP memory limit has been increased!

Was this article helpful?