Question

What would cause a server to "lose" a file, or function?

My server is pretty straightforward. Centos, PHP, Nginx, Apache, etc. Two days ago I started getting an error in my logs that it could not find a file that was there plain as day. After I deleted, then replaced the file, and restarted Apache things worked.

Today I started getting an error that it couldn’t find a PHP function in a class that extended another class. I renamed both files to old, then uploaded the original file and things started working again.

Permissions do not appear to have been changed and neither has the ownership changed.

These files in question haven’t been update/touched in months.

Looking for ideas as to what might be going on.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
February 7, 2024
Accepted Answer

Hey,

From what you’re describing, it sounds like you’re experiencing a rather peculiar issue. Files and functions “disappearing” or becoming “unrecognized” despite being present and unchanged for months can indeed be baffling. Given the stack you’re working with (CentOS, PHP, Nginx, Apache), there are a few areas we can explore to troubleshoot this issue:

  1. OPcache Issues: OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thus eliminating the need for PHP to load and parse scripts on each request. However, if there are issues with the cache, it could lead to PHP not recognizing changes to files or, in rare cases, functions. Clearing the OPcache (opcache_reset();) or temporarily disabling it could help determine if this is the cause. This might also be related to the available RAM on the server.

  2. Inodes Running Out: If your server is running out of inodes, it could lead to strange filesystem behavior, including the inability to recognize existing files. You can check inode usage with df -i. Here is a guide on how to check your disk usage as well:

https://www.digitalocean.com/community/questions/28-no-space-left-on-device-error

  1. Review Logs: Lastly, don’t forget to go through your Apache, Nginx, and PHP error logs around the times the issues occurred. They might offer more specific clues as to what’s happening. Sometimes, the error messages can be misleading or vague, but they are a good starting point for troubleshooting.

Let me know how it goes!

Best,

Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel