Title: Open_basedir restriction
Last modified: December 28, 2024

---

# Open_basedir restriction

 *  Resolved [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/)
 * Since doing updates of WordPress core and this plugin all my old files under 
   Download Monitor are showing the error “Warning: file_exists(): open_basedir 
   restriction in effect” when being managed in the Dashboard. The files are downloading
   for users okay.
 * Strangely new files do not have this problem but I note that they are not being
   moved into the download folder but being left in the usual media folders.
 * Why is this?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18219796)
 * Hello [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * Thanks for reaching out to us!
 * It appears that the issue is related to the server’s open_basedir setting, which
   is a security feature that restricts access to files outside specified directories.
   The message indicates that the required file is not within the allowed paths.
 * To resolve this, please either adjust the open_basedir settings in your cPanel,
   contact your hosting provider to disable open_basedir restrictions, or add the
   necessary paths to the allowed list.
 * Please try it and let me know!
 * Warmly,
 * Beatrice.
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18219871)
 * I understand what you are saying but the newly added files do not show this warning.
 * So the file 
   /wp-content/uploads/dlm_uploads/2024/08/XXXXX-129.pdf does show 
   this error in the Dashboard butwp-content/uploads/dlm_uploads/2024/12/xxxx-130.
   pdf does not
 * I doubt the access level controls for openbasedir go to this level
 *  [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18220599)
 * Hello [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * It looks like the older files are being affected by the server’s open_basedir
   settings because of where they were saved. The new files are probably stored 
   differently, which is why they don’t show the same warning.
 * I recommend contacting your hosting provider to find out why the older files 
   in the /2024/08/ folder are restricted while the newer ones in /2024/12/ are 
   not. They should be able to check the server settings and help fix it.
 * Warm regards,
 * Beatrice.
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18221012)
 * The full warning message is
   **Warning**: file_exists(): open_basedir restriction
   in effect. File(/wp-content/uploads/dlm_uploads/2024/08/Dufour-News-129.pdf) 
   is not within the allowed path(s): (/home:/home2:/home3:/usr/local/apache/htdocs:/
   tmp:/usr/local/php80/lib/php:/usr/local/lib/php:/usr/share:/etc/xml:/etc/pki:/
   usr/bin-safe:/dev/urandom:/dev/null:/proc/version) in **/home/dufour/P4ML4XO9/
   htdocs/wp-content/plugins/download-monitor/src/FileManager.php** on line **87**
 * So the paths set by the server do not go down to that level of folder such that
   the different folders in the dlm_uploads folder would be different. Could there
   be some other explanation?
 * I have now added some debug instructions to your code and identified the following:
   
   For the file which does not produce the error the $parsed_file_path[‘scheme’]
   includes “https” but for the file which gives the warning the https is missing(
   ignore the | which was my separators.debug:|https|/wp-content/uploads/dlm_uploads/
   2024/12/Dufour-News-130.pdf|debug:||/wp-content/uploads/dlm_uploads/2024/08/Dufour-
   News-129.pdf|
 * So why would the https be different and how to fix this?
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18224368)
 * Now having looked in the database I find that in postmeta table the meta_key 
   values for the older downloads are shortened paths while the new ones include
   the full file reference inc. the https and domain name.
   So why would this have
   changed, and how do I fix it?
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18234899)
 * Any update on this?
 *  [beatrice12](https://wordpress.org/support/users/beatrice12/)
 * (@beatrice12)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18235963)
 * Hello [@bobjgarrett](https://wordpress.org/support/users/bobjgarrett/),
 * Apologies for the late reply!
 * The issue you’re experiencing seems to be related to calling `file_exists()` 
   on a relative path, which can sometimes conflict with `open_basedir()` restrictions
   on certain servers.
 * A potential solution would be to change all the relative paths in your downloads
   to absolute ones. For example, instead of using `/wp-content/uploads/dlm_uploads/
   2025/01/file.txt`, you would use the full URL: `https://your-site-domain.com/
   wp-content/uploads/dlm_uploads/2025/01/file.txt`.
 * If you prefer not to handle this manually, we will be releasing a fix in the 
   next update to address the issue.
 * Warm regards,
   Beatrice.
 *  Thread Starter [bobjgarrett](https://wordpress.org/support/users/bobjgarrett/)
 * (@bobjgarrett)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18236021)
 * Thanks for the response. It seems strange that it affects the Dashboard view 
   but not users’ views. I will probably await the fix.
 *  [cristinnaiulia](https://wordpress.org/support/users/cristinnaiulia/)
 * (@cristinnaiulia)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18242448)
 * This topic will be marked as resolved as we have an open ticket on GitHub regarding
   this. Please keep in mind that the ‘resolved’ status is only for this support
   thread, not the issue on GitHub.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Open_basedir restriction’ is closed to new replies.

 * ![](https://ps.w.org/download-monitor/assets/icon-256x256.png?rev=3198936)
 * [Download Monitor](https://wordpress.org/plugins/download-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/download-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/download-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/download-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/download-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/download-monitor/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [cristinnaiulia](https://wordpress.org/support/users/cristinnaiulia/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/open_basedir-restriction-9/#post-18242448)
 * Status: resolved