Skip to content

How to Fix cPanel PHP ini Configuration Errors

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix cPanel PHP ini Configuration Errors. We cover key concepts, practical examples, and best practices.

The Problem

PHP settings are not applying:

Changes to php.ini have no effect.

or:

Fatal error: Allowed memory size exhausted.

Quick Fix

Step 1: Find the correct php.ini

# Create a PHP file with:
<?php phpinfo(); ?>

Look for "Loaded Configuration File" to find the active php.ini.

Or use the command line:

php -i | grep "Loaded Configuration File"

Step 2: Use cPanel's MultiPHP INI Editor

cPanel > Software > MultiPHP INI Editor > Select your domain

Change settings:

memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

Step 3: Edit the correct .htaccess

If MultiPHP is not available, use .htaccess:

php_value memory_limit 256M
php_value upload_max_filesize 64M
php_value post_max_size 64M

Step 4: Apply changes to a specific PHP version

# For PHP 8.0:
/opt/cpanel/ea-php80/root/etc/php.ini

# For PHP 8.1:
/opt/cpanel/ea-php81/root/etc/php.ini

Step 5: Restart PHP-FPM

/scripts/restartsrv_apache_php_fpm

Step 6: Verify the changes

Create test.php:

<?php
echo 'Memory: ' . ini_get('memory_limit');
echo 'Upload: ' . ini_get('upload_max_filesize');
?>

Prevention

  • Use MultiPHP INI Editor in cPanel for per-domain settings.
  • Restart PHP-FPM after changing php.ini.
  • Test changes with phpinfo() after applying.

Common Mistakes with php ini

  1. Misunderstanding that String is [Char] with poor performance for large text operations
  2. Using foldl instead of foldl' causing stack overflow on large lists
  3. Forgetting deriving (Show, Eq) on custom data types needed for debugging

These mistakes appear frequently in real-world CPANEL code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between MultiPHP INI and .htaccess for PHP settings?

MultiPHP INI changes apply system-level PHP configuration. .htaccess changes apply per-directory and may be overridden by system settings.

Why does my php.ini change not show in phpinfo()?

You may be editing the wrong php.ini file, or PHP-FPM was not restarted. Check the "Loaded Configuration File" path in phpinfo().

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro