To disable or remove a systemd drop-in file like /etc/systemd/system/httpd.service.d/php81-php-fpm.conf — which modifies the behavior of the httpd.service (Apache HTTP Server) — you have a few options depending on whether you want to:
- Temporarily disable the effect of the drop-in,
- Permanently remove or disable the drop-in file, or
- Override it with an empty or modified configuration.
✅ Option 1: Permanently Remove the Drop-In File
If you don't need the configuration provided by php81-php-fpm.conf anymore, simply delete it:
sudo rm /etc/systemd/system/httpd.service.d/php81-php-fpm.conf
After removing the drop-in:
-
Reload systemd to recognize changes:
sudo systemctl daemon-reexec # Optional in most cases; use if unsure.
sudo systemctl daemon-reload
-
Restart the httpd service to apply changes:
sudo systemctl restart httpd
✅ This is the cleanest and most effective way to prevent the drop-in from having any effect.
✅ Option 2: Temporarily Mask or Override the Drop-In Behavior
If you want to keep the file but prevent it from being used temporarily, you can override it by creating an empty drop-in that overrides the same directives (advanced usage), or mask the whole service (not recommended in your case).
However, a better approach for temporary disabling is:
Override with an Empty Configuration
-
Create an override directory (if not already present):
sudo mkdir -p /etc/systemd/system/httpd.service.d
-
Create an empty drop-in file (e.g., php81-php-fpm.conf.override):
sudo nano /etc/systemd/system/httpd.service.d/php81-php-fpm.conf.override
Leave it empty and save.
⚠️ But note: this doesn't "cancel" the original drop-in — systemd merges all drop-ins. So this method may not help unless you're overriding specific directives.
Better yet:
Better Method: Just mask the old drop-in by renaming it
If you just want to disable it temporarily without deleting:
sudo mv /etc/systemd/system/httpd.service.d/php81-php-fpm.conf /etc/systemd/system/httpd.service.d/php81-php-fpm.conf.disabled
Then reload and restart:
sudo systemctl daemon-reload
sudo systemctl restart httpd
This way, the file is no longer loaded because systemd only loads files ending in .conf from drop-in directories.
⚠️ You must reload systemd with daemon-reload after any changes to drop-in files or their names.
✅ Option 3: Mask the Whole Service (Not Recommended Here)
Do not do this if you only want to stop one drop-in. Use this only if you want to completely prevent httpd from starting:
sudo systemctl mask httpd
But this is too heavy-handed for your use case.
🔍 Verify That the Drop-In Is No Longer Applied
After making changes, check what systemd is using:
systemctl cat httpd.service
This shows the full unit file, including drop-ins. If you've removed or renamed the file correctly, the contents from php81-php-fpm.conf should no longer appear.
Summary
| Goal | Recommended Action |
|---|
| Permanently disable drop-in | Delete the .conf file |
| Temporarily disable drop-in | Rename it (e.g., add .disabled suffix) |
| Prevent config from loading | Override with empty or corrected drop-in (advanced) |
After any change, always run:
sudo systemctl daemon-reload
sudo systemctl restart httpd
Let me know if you also want to clean up php82-php-fpm.conf or switch between multiple PHP-FPM versions cleanly.