You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress网站PHP致命错误求助:缺少random_compat/random.php文件

Hey there, let’s get your mom’s dog grooming site back up first—then we’ll lock things down so this doesn’t happen again. I’ve seen this exact error a bunch, so let’s break it down step by step.

Fix the Immediate Missing File Error

That fatal error is telling us WordPress can’t find the file /wp-includes/random_compat/random.php. Here’s how to fix it fast:

  • Check if the file exists: Fire up your FTP client, navigate to your WordPress folder, then go into wp-includes/random_compat/. If random.php is nowhere to be seen, that’s the root issue.
  • Replace the missing folder: Head to WordPress.org and download the exact same version your site is running (you can check this by opening readme.html in your root WordPress folder via FTP). Extract the zip file, grab the random_compat folder from the fresh wp-includes directory, and upload it to your site’s wp-includes folder via FTP. Overwrite any existing files if prompted—this won’t touch your mom’s content, themes, or plugins.
  • Double-check permissions: If the file exists but you still get the error, right-click it in FTP and check permissions. Core WordPress files should be set to 644, folders to 755. Adjust if needed.
Why Multiple Backups Aren’t Working

It sounds like your host’s backups might be corrupted, or they’re missing core files. Here’s what to verify:

  • When you restore a backup, compare the wp-includes folder structure to the fresh WordPress download. Are any other folders missing? Sometimes backups skip small core folders without warning.
  • Make sure you’re restoring both files and the database—if the backup only includes one or the other, you’ll get mismatched errors every time.
Long-Term Maintenance to Keep the Site Reliable

Since your mom’s losing clients, let’s set up safeguards to avoid downtime in the future:

  • Take control of backups: Don’t rely solely on your host. Install a free plugin like UpdraftPlus to schedule weekly full backups (files + database) and store them in Google Drive or Dropbox. Every month, do a quick test restore on a staging site (many hosts offer this for free) to make sure the backup works.
  • Stay updated: Enable automatic updates for WordPress core (you can do this in Settings > General). For themes and plugins, update them manually once a month—always backup first before hitting that update button.
  • Monitor downtime: Use Jetpack’s free downtime monitoring (or a similar tool) to get email alerts the second the site goes down. That way, you can fix issues before clients notice.
  • Monthly health checks: WordPress has a built-in Tools > Site Health tool. Run this once a month—it’ll scan for missing core files, outdated software, and other red flags.
Quick Emergency Fix (If You’re in a Rush)

If you need the site up right now, backup your current wp-includes folder first, then replace the entire wp-includes directory with a fresh copy from the same WordPress version. This will fix any missing or corrupted core files in one go—just don’t touch wp-content (that’s where your mom’s themes, plugins, and photos live!).

Always remember: Backup before making any changes via FTP—it’s a lifesaver if something goes wrong.

内容的提问来源于stack exchange,提问作者Janneau

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:13:59