📌 Context
- Status: RESOLVED
- Environment: PHP 8.3 / Symfony 7.4 LTS / cPanel Shared Hosting / Composer (
--classmap-authoritative) - Date: 2026-11-24
- Detected in: Production (cPanel subdomain), immediately after executing database migrations via phpMyAdmin following a
release.zipextraction over an existing deployment. Not triggered in local development because local git checkouts remove deleted/renamed files automatically. - Component:
config/services.yaml,vendor/composer/autoload_classmap.php,var/cache/prod/,src/Controller/Admin/RtCommunityCrudController.php(deleted in commit6472657)
🛑 Symptoms & Error Log
After deploying an updated dist/release.zip onto an existing cPanel installation and running the migration SQL in phpMyAdmin, web requests failed with an HTTP 500 error. The production error log recorded:
[24-Nov-2026 11:14:44 UTC] 2026-11-24T11:14:44+00:00 [critical] Uncaught Exception: Expected to find class "App\Controller\Admin\RtCommunityCrudController" in file "/home/<user>/public_html/<subdomain>.<domain>/src/Controller/Admin/RtCommunityCrudController.php" while importing services from resource "../src/", but it was not found! Check the namespace prefix used with the resource in /home/<user>/public_html/<subdomain>.<domain>/config/services.yaml (which is being imported from "/home/<user>/public_html/<subdomain>.<domain>/src/Kernel.php").
Detection: The failure was noticed immediately in the cPanel error log (prod.log / PHP error_log) upon hitting the application after running the database migration in phpMyAdmin (hard HTTP 500 crash during Symfony container compilation, not a silent failure).
🔍 Root Cause Analysis / Current Hypotheses
- Archive extraction does not remove deleted/renamed files:
Extracting dist/release.zip over an existing cPanel directory overwrites modified files and adds new files, but leaves behind files that were deleted or renamed in newer commits.
- Leftover files from commit
6472657:
In commit 6472657, three classes under src/ were deleted or renamed:
src/Controller/Admin/RtCommunityCrudController.php-> deleted (replaced bysrc/Controller/Admin/CommunityCrudController.php)src/Entity/RtCommunity.php-> renamed tosrc/Entity/Community.phpsrc/Repository/RtCommunityRepository.php-> renamed tosrc/Repository/CommunityRepository.php
- Interaction between
services.yamldirectory scanning and Composer--classmap-authoritative:
config/services.yaml imports all PHP files under src/ via App\: resource: '../src/'. At the same time, scripts/build-release.sh builds production dependencies with composer install --no-dev --optimize-autoloader --classmap-authoritative. Because the leftover RtCommunityCrudController.php still existed on disk in src/Controller/Admin/, Symfony’s service loader expected App\Controller\Admin\RtCommunityCrudController to exist, while Composer’s authoritative classmap no longer listed it, causing a fatal exception during container compilation.
🚫 Attempted Solutions & Failed Approaches
- Extracting
dist/release.zipover the existing deployment and running database migrations in phpMyAdmin without removing oldsrc/files -> Failed withExpected to find class "App\Controller\Admin\RtCommunityCrudController" in file ".../src/Controller/Admin/RtCommunityCrudController.php" while importing services from resource "../src/", but it was not found! - Checking/suspecting file or folder permissions -> Not the cause; permission errors on
var/cache/prod/orsrc/producePermission deniedorUnable to write in the "cache" directoryerrors rather than a missing class error fromservices.yaml.
💡 Working Solution / Resolution (or Temporary Workaround)
Remove the leftover deleted/renamed files from src/ on the cPanel server and clear the production cache (var/cache/prod/*):
cd /home/<user>/public_html/<subdomain>.<domain>
# 1. Remove leftover files deleted/renamed in commit 6472657
rm -f \
src/Controller/Admin/RtCommunityCrudController.php \
src/Entity/RtCommunity.php \
src/Repository/RtCommunityRepository.php
# 2. Clear production cache and warm up
rm -rf var/cache/prod/*
APP_ENV=prod php bin/console cache:warmup
🛡 Prevention / Next Steps
- Catch it before production: Before packaging or deploying a release that deletes or renames classes under
src/, checkgit diff --name-status <last_deployed_commit>..HEAD -- src/forD(deleted) orR(renamed) entries, and verifyAPP_ENV=prod php bin/console cache:warmupsucceeds after a clean extraction ofdist/release.zipinto a temporary directory. - Clean directory before extracting
release.zipon cPanel: When updating an existing cPanel installation, deletesrc/,templates/,config/, andvendor/before extracting the newdist/release.zip(while preserving.env.local,var/, and any uploaded user files).