Zawieszam

Resolve the open_basedir restriction

Apr 2nd, 2025
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | Software | 0 0
  1. How to resolve the open_basedir restriction in effect error in WordPress.
  2.  
  3. WordPress site suddenly started getting this error on administrative pages.
  4. Warning: file_exists(): open_basedir restriction in effect. File(core/post-comments) is not within the allowed path(s): (/data/web/virtuals/269369/virtual) in /data/web/virtuals/269369/virtual/www/domains/mfproductions.cz/wp-includes/blocks.php on line 532
  5. This solution involves modifying the wp-includes/blocks.php file temporarily to bypass the issue.
  6.  
  7. php
  8. // Original code in wp-includes/blocks.php on line 532
  9. if (is_string( $block_type ) && file_exists( $block_type ) ) {
  10.  
  11. // Updated code to fix the open_basedir restriction issue
  12. if ($block_type != "core/post-comments" && is_string( $block_type ) && file_exists( $block_type ) ) {
  13.  
  14. Steps to Apply the Fix:
  15.  
  16. Locate the File: Navigate to wp-includes/blocks.php in your WordPress installation.
  17. Edit the File: Find line 532 and replace:
  18.  
  19. php
  20. if (is_string( $block_type ) && file_exists( $block_type ) ) {
  21.  
  22. with:
  23.  
  24. php
  25. if ($block_type != "core/post-comments" && is_string( $block_type ) && file_exists( $block_type ) ) {
  26.  
  27. Save Changes: Save and upload the modified file back to your server.
  28. Update WordPress: After applying this fix, update all plugins and WordPress core to ensure compatibility.
  29. Revert Changes: Once everything is updated and working, revert the change in blocks.php for a cleaner setup.
  30.  
Tags: basedir
Advertisement
Add Comment
Please, Sign In to add comment