PHP warning whenever I replace an image
-
I’m seeing this in our PHP error log when replacing an image:
PHP message: PHP Warning: is_dir(): open_basedir restriction in effect. File(/wp-content/uploads/2025/09/headshot) is not within the allowed path(s): (/www/USERNAME/public:/www/USERNAME/mysqleditor:/www/USERNAME/web:/www/USERNAME/deploy:/www/USERNAME/deployment:/www/USERNAME/deployments:/www/USERNAME/tmp:/usr/share:/tmp:/www/USERNAME/marketo_env:/dev/urandom) in /www/USERNAME/public/wp-content/plugins/enable-media-replace/build/shortpixel/replacer/src/Replacer.php on line 87" while reading response header from upstream, client: 127.0.0.1, server: www.domain.com, request: "POST /wp-admin/upload.php?page=enable-media-replace/enable-media-replace.php&action=media_replace_upload&attachment_id=128797 HTTP/2.0", upstream: "fastcgi://unix:/var/run/php8.3-fpm-resolvercom.sock:", host: "www.domain.com:59087", referrer: "https://www.domain.com/wp-admin/upload.php?page=enable-media-replace%2Fenable-media-replace.php&action=media_replace&attachment_id=128797
I spoke with my host and they say it’s becauseFile(/wp-content/uploads/2025/09/headshot) is not within the allowed path(s)doesn’t have the absolute path that includes/www/USERNAME/public/.Images get replaced just fine, it’s just that this error will always show in the error log whenever I do a replacement.
(Username, IP, and domain have been obfuscated by me for this post.)
The topic ‘PHP warning whenever I replace an image’ is closed to new replies.