Weird problem with pThumb and server root directory

My web host just moved all my sites to a new server. This server has “home3” as the root instead of “home”. They have a symlink installed to point “home” to “home3”. Everything works fine, EXCEPT that thumbnails created with pThumb are not getting saved. The log is filled up with errors saying that the thumbnail directory “home/NNNN/assets/image-cache/ . . .” is outside the server root. So, it is not realizing that ‘home’ is a symlink, so the thumbnails don’t get saved. If I change the phpthumb system setting to use Resizer, then the thumbnails get saved.

Is this a bug in pThumb, or in MODX’s phpThumb, or something else?

Did you make any changes to the MODX config files to account for that, or do you rely on the symlink?


Maybe try if setting the system setting phpthumb_document_root helps.


What is the actual error message? What line of code generates it?

You should edit the core/config.php and change all folder paths containing the old home folder.

Yes, that’s what I’m doing, but I’d prefer not to HAVE to do that. I have 30 websites on this server, so it’s a pain. If this IS a bug, it should be fixed if possible.

I didn’t change the config files until I noticed that image thumbnails weren’t get created, and then saw the error messages. The old server had “home” for the root, so that’s what’s in the config file. My question is, why is the symlink working in MODX for everything except pThumb?

How much of the path do I need to put in there?

Here’s a sample error message:

Could not generate thumbnail
phpThumb debug output:
    [0] => phpThumb() v1.7.22-202312071641 in file "phpthumb.class.php" on line 279
    [1] => setSourceFilename(/home/beyondpe/public_html/dailynewsblog/wp-content/uploads/2025/10/DN-10.22.25.jpg) set $this->sourceFilename to "/home/beyondpe/public_html/dailynewsblog/wp-content/uploads/2025/10/DN-10.22.25.jpg" in file "phpthumb.class.php" on line 347
    [2] => Addding ImageMagick formats to $AvailableImageOutputFormats (text;ico;bmp;wbmp;gif;avif;webp;png;jpeg) in file "phpthumb.class.php" on line 1065
    [3] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;avif;webp;png;jpeg) in file "phpthumb.class.php" on line 1071
    [4] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 1083
    [5] => $this->thumbnailFormat set to $this->f "jpeg" in file "phpthumb.class.php" on line 1090
    [6] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 1100
    [7] => resolvePath: /home/beyondpe/public_html/dailynewsblog/wp-content/uploads/2025/10/DN-10.22.25.jpg (allowed_dirs: Array
(
)
) in file "phpthumb.class.php" on line 1243
    [8] => resolvePath: iteration, path=/home/beyondpe/public_html/dailynewsblog/wp-content/uploads/2025/10/DN-10.22.25.jpg, base path = /home3/beyondpe/public_html in file "phpthumb.class.php" on line 1262
    [9] => open_basedir: "" in file "phpthumb.class.php" on line 1229
    [10] => resolvePath: stop at component 2 in file "phpthumb.class.php" on line 1278
    [11] => resolvePath: stop at path=/home/beyondpe in file "phpthumb.class.php" on line 1281
    [12] => resolvePath: no match, returning null in file "phpthumb.class.php" on line 1283
    [13] => !$this->config_allow_src_above_docroot therefore setting "/home/beyondpe/public_html/dailynewsblog/wp-content/uploads/2025/10/DN-10.22.25.jpg" (outside "/home3/beyondpe/public_html") to null in file "phpthumb.class.php" on line 1454
    [14] => $this->sourceFilename set to "" in file "phpthumb.class.php" on line 988
    [15] => phpThumb() v1.7.22-202312071641
http://phpthumb.sourceforge.net

That’s the way MODX works, sorry. Symlinks are not supported that good in PHP.

I think it expects the ‘same’ path as the base_path setting.

Tried that and it didn’t work. I ended up just updating the config file for all websites.