• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Issue WordPress Image Upload Error - "Server cannot process the image" - PHP limits issue

majdi draouil

New Pleskian
Server operating system version
Ubuntu 22.04.5 LTS
Plesk version and microupdate number
Obsidian18.0.72
Environment:
============
- Plesk Version: Obsidian (latest)
- OS: Ubuntu 22.04.5 LTS
- PHP Version: 8.2.29 (FPM)
- WordPress Version: 6.7.0
- Domain: nefzawa.net

Problem:
========
WordPress shows this error when uploading images:

"The server cannot process the image. This can happen if the server is busy
or does not have enough resources to complete the task. Uploading a smaller
image may help. Suggested maximum size is 2,560 pixels."

What I've Found:
================
1. PHP CLI (php.ini) shows CORRECT limits:
memory_limit => 512M
upload_max_filesize => 512M
post_max_size => 512M

2. PHP-FPM Pool Config has NO limits or only:
/opt/plesk/php/8.2/etc/php-fpm.d/nefzawa.net.conf

php_value[memory_limit] = 256M

(Missing: upload_max_filesize and post_max_size)

3. Nginx configured correctly:
client_max_body_size 134217728;

4. Both GD and Imagick extensions are loaded
5. Upload directory permissions are correct (drwxr-xr-x)
6. Previous uploads worked fine (October 2025 folder has images)

What I Tried:
=============
Command:
plesk bin php_settings -u -domain nefzawa.net -memory-limit 512M -upload-max-filesize 512M -post-max-size 512M

Result: "Per-domain PHP settings of all domains were successfully updated."

Problem: FPM pool config file doesn't actually change!

Verification:
grep -E "memory_limit|upload_max|post_max" /opt/plesk/php/8.2/etc/php-fpm.d/nefzawa.net.conf

Still shows old values or empty.


Additional Info:
================
- No errors in /var/log/plesk-php82-fpm/error.log
- WordPress debug.log is empty
- Server resources are fine (40% memory, 78% disk)
- PHP-FPM service is active and running

Has anyone solved this issue where Plesk doesn't properly apply PHP-FPM pool
limits for WordPress image uploads?[/CODE]
 

Attachments

  • Screenshot_2025-11-01_00-10-42.png
    Screenshot_2025-11-01_00-10-42.png
    45.4 KB · Views: 4
  • Screenshot_2025-10-31_23-46-09.png
    Screenshot_2025-10-31_23-46-09.png
    60 KB · Views: 4
  • Screenshot_2025-10-31_23-45-14.png
    Screenshot_2025-10-31_23-45-14.png
    132.8 KB · Views: 4
The max body size looks to be set to roughly 134MB so depending on how big the image you're uploading if it's over that it will not be uploaded although I will recommand setting the max body size in the domain > apache & nginx settings, there's a setting there for "Maximum allowed HTTP request body size" to match the settings you have for the PHP configuration.
 
I know that similar issues have been caused by Cloudflare. In this article, there's a section "Accessing a website / webmail using a local hosts file" - that will allow you to force the domain name directly resolve on the server bypassing Cloudflare. Could you please temporarily add the entries to your local hosts file, test the upload again and confirm if the issue still persists?
 
I already bypassed Cloudflare by changing NS to direct VPS-no orange cloud nonsense. Already propagated, still no upload. Can you give cmd to diagnose and send back
 
grep -i "upload\|image\|media" /var/www/vhosts/majdi.com/logs/error_log | tail -20
[Sun Nov 09 21:34:24.419747 2025] [fcgid:warn] [pid 36514:tid 140303819847232] [client 197.244.51.98:0] mod_fcgid: stderr: #2 /var/www/vhosts/majdi.com/httpdocs/wp-admin/upload.php(10): require_once('...'), referer: majdi.com
[Sun Nov 09 21:34:24.419772 2025] [fcgid:warn] [pid 36514:tid 140303819847232] [client 197.244.51.98:0] mod_fcgid: stderr: #3 {main}, referer: majdi.com
[Sun Nov 09 21:34:24.419780 2025] [fcgid:warn] [pid 36514:tid 140303819847232] [client 197.244.51.98:0] mod_fcgid: stderr: thrown in /var/www/vhosts/majdi.com/httpdocs/wp-config.php on line 103, referer: majdi.com
[Sun Nov 09 21:34:25.307054 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to undefined function add_filter() in /var/www/vhosts/majdi.com/httpdocs/wp-config.php:103, referer: majdi.com
[Sun Nov 09 21:34:25.307116 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: Stack trace:, referer: majdi.com
[Sun Nov 09 21:34:25.307125 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: #0 /var/www/vhosts/majdi.com/httpdocs/wp-load.php(50): require_once(), referer: majdi.com
[Sun Nov 09 21:34:25.307132 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: #1 /var/www/vhosts/majdi.com/httpdocs/wp-admin/admin.php(35): require_once('...'), referer: majdi.com
[Sun Nov 09 21:34:25.307139 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: #2 /var/www/vhosts/majdi.com/httpdocs/wp-admin/upload.php(10): require_once('...'), referer: majdi.com
[Sun Nov 09 21:34:25.307175 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: #3 {main}, referer: majdi.com
[Sun Nov 09 21:34:25.307183 2025] [fcgid:warn] [pid 36514:tid 140303554045504] [client 197.244.51.98:0] mod_fcgid: stderr: thrown in /var/www/vhosts/majdi.com/httpdocs/wp-config.php on line 103, referer: majdi.com
[Sun Nov 09 21:36:17.145499 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to undefined function add_filter() in /var/www/vhosts/majdi.com/httpdocs/wp-config.php:103, referer: majdi.com
[Sun Nov 09 21:36:17.145572 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: Stack trace:, referer: majdi.com
[Sun Nov 09 21:36:17.145581 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: #0 /var/www/vhosts/majdi.com/httpdocs/wp-load.php(50): require_once(), referer: majdi.com
[Sun Nov 09 21:36:17.145589 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: #1 /var/www/vhosts/majdi.com/httpdocs/wp-admin/admin.php(35): require_once('...'), referer: majdi.com
[Sun Nov 09 21:36:17.145595 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: #2 /var/www/vhosts/majdi.com/httpdocs/wp-admin/upload.php(10): require_once('...'), referer: majdi.com
[Sun Nov 09 21:36:17.145622 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: #3 {main}, referer: majdi.com
[Sun Nov 09 21:36:17.145629 2025] [fcgid:warn] [pid 36514:tid 140302991996480] [client 197.244.51.98:0] mod_fcgid: stderr: thrown in /var/www/vhosts/majdi.com/httpdocs/wp-config.php on line 103, referer: majdi.com
[Mon Nov 10 05:24:02.865239 2025] [autoindex:error] [pid 147754:tid 140303545652800] [client 185.102.115.31:0] AH01276: Cannot serve directory /var/www/vhosts/majdi.com/httpdocs/wp-admin/images/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm,index.shtml) found, and server-generated directory index forbidden by Options directive
[Mon Nov 10 06:07:25.204713 2025] [proxy_fcgi:error] [pid 147753:tid 140302656452160] [client 197.244.51.98:0] AH01067: Failed to read FastCGI header, referer: majdi.com
[Mon Nov 10 06:07:25.204823 2025] [proxy_fcgi:error] [pid 147753:tid 140302656452160] (104)Connection reset by peer: [client 197.244.51.98:0] AH01075: Error dispatching request to : , referer: majdi.com
root@vmi1717253:~#
 
add_filter() is a core WordPress function defined in wp-includes/plugin.php.
It’s used to register a filter hook — in other words, it lets you modify or extend WordPress functionality.
The error says: PHP Fatal error: Uncaught Error: Call to undefined function add_filter() in wp-config.php:103
That means your file /var/www/vhosts/majdi.com/httpdocs/wp-config.php is calling add_filter() before WordPress has loaded wp-includes/plugin.php — which defines that function.
In WordPress, the load order matters:
wp-config.php <-- early config file
wp-settings.php <-- loads the full WordPress core, including add_filter()
So if you call add_filter() inside wp-config.php, it will fail — because WordPress functions are not available yet at that point.

Fixing:
You have two main options, depending on what the code is trying to do.
1. Move the add_filter() call
If it’s adding a normal WordPress hook (e.g., filtering content, modifying queries, etc.), move that line into:
- your theme’s functions.php, or
- a custom plugin file.
Example:
Move this from wp-config.php:
add_filter('upload_mimes', 'allow_svg_uploads');
to your theme’s functions.php, for example:
function allow_svg_uploads($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_svg_uploads');

2. If you must keep it in wp-config.php (rare), wrap it so it only runs after WordPress is ready:
if (function_exists('add_filter')) {
add_filter(...);
}
But really, that’s a workaround — the proper fix is to move it into WordPress’ load phase (theme or plugin).
 
add_filter() is a core WordPress function defined in wp-includes/plugin.php.
It’s used to register a filter hook — in other words, it lets you modify or extend WordPress functionality.
The error says: PHP Fatal error: Uncaught Error: Call to undefined function add_filter() in wp-config.php:103
That means your file /var/www/vhosts/majdi.com/httpdocs/wp-config.php is calling add_filter() before WordPress has loaded wp-includes/plugin.php — which defines that function.
In WordPress, the load order matters:
wp-config.php <-- early config file
wp-settings.php <-- loads the full WordPress core, including add_filter()
So if you call add_filter() inside wp-config.php, it will fail — because WordPress functions are not available yet at that point.

Fixing:
You have two main options, depending on what the code is trying to do.
1. Move the add_filter() call
If it’s adding a normal WordPress hook (e.g., filtering content, modifying queries, etc.), move that line into:
- your theme’s functions.php, or
- a custom plugin file.
Example:
Move this from wp-config.php:
add_filter('upload_mimes', 'allow_svg_uploads');
to your theme’s functions.php, for example:
function allow_svg_uploads($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'allow_svg_uploads');

2. If you must keep it in wp-config.php (rare), wrap it so it only runs after WordPress is ready:
if (function_exists('add_filter')) {
add_filter(...);
}
But really, that’s a workaround — the proper fix is to move it into WordPress’ load phase (theme or plugin).
Hi @Bitpalast,


Thanks for the detailed explanation! I've run the diagnostics you suggested. Here's what I found:


Lines 95-115 of wp-config.php:




define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

define('WP_MEMORY_LIMIT', '1024M');
define('WP_MAX_MEMORY_LIMIT', '1024M');

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

Search for add_filter/add_action in wp-config.php:




(no results - wp-config.php is clean, no add_filter or add_action calls found)

Active theme functions.php files found:




/wp-content/themes/twentytwentyfour/functions.php
/wp-content/themes/twentytwentyfive/functions.php

Recent PHP-FPM error log:




(empty - no recent errors logged)

My confusion:The error logs I posted earlier (post #7) showed the add_filter() fatal error on line 103 of wp-config.php, but when I check the current file, line 103 is clean - it's just part of the standard WordPress bootstrap code.


Could this mean:


  1. The issue was already fixed by someone/something?
  2. Should I be checking a different file?
  3. Is the image upload problem now a separate issue from the add_filter() error?

The original problem still exists - WordPress cannot upload images, showing "The server cannot process the image" error, even though:


  • Cloudflare has been bypassed (changed to direct NS)
  • PHP limits are set to 512M-1024M
  • No current errors in PHP-FPM logs

What should I check next?
 
Line 103 could be in an "include", counting the total number of lines from line 0 of wp-config.php to line 103 when you imagine the include was inline in wp-config.php. Besides that, I cannot answer the questions as that would require checking it on the installation.
 
Line 103 could be in an "include", counting the total number of lines from line 0 of wp-config.php to line 103 when you imagine the include was inline in wp-config.php. Besides that, I cannot answer the questions as that would require checking it on the installation.




Hi @Bitpalast,


Excellent point about included files! Here's what I found:


Files required/included in wp-config.php:

109:/** Sets up WordPress vars and included files. */
110:require_once ABSPATH . 'wp-settings.php';


Only the standard WordPress bootstrap file is included - nothing custom.


Complete wp-config.php structure (lines 95-110):

define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);

define('WP_MEMORY_LIMIT', '1024M');
define('WP_MAX_MEMORY_LIMIT', '1024M');

/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';


Search for add_filter/add_action:No results - wp-config.php contains NO add_filter() or add_action() calls.


Recent error log analysis:The current error log shows only:


  • Directory indexing attempts (security scans - normal)
  • ModSecurity warnings (WAF alerts - normal)
  • NO PHP fatal errors about add_filter()

My conclusion:The add_filter() error from post #7 (November 9th) seems to have been resolved or was from a different site. The current majdi.com wp-config.php is completely clean and follows standard WordPress structure.


However, the original image upload problem still persists even with:


  • Clean wp-config.php
  • PHP limits at 512M-1024M
  • No Cloudflare
  • No current PHP errors






Copy and paste this into the forum thread.
 
What are the dimensions of the image?

Does the issue occur with:

1). All plugins disabled? (if not, enable them)

2). Temporarily changing to a different theme?

At this juncture it sounds like the issue is coming from a code level issue rather than the server itself.
 
Back
Top