═══════════════════════════════════════════════════════════════ CPANEL DEPLOYMENT - QUICK REFERENCE CARD Fix: "symlink(): File exists" Error ═══════════════════════════════════════════════════════════════ 📍 YOUR SITE: test.algopk.com ═══════════════════════════════════════════════════════════════ BEFORE UPLOAD (On Windows) ═══════════════════════════════════════════════════════════════ 1. Run: prepare-for-cpanel.bat 2. Compress project to .zip 3. Upload to cPanel ═══════════════════════════════════════════════════════════════ AFTER UPLOAD (On cPanel) ═══════════════════════════════════════════════════════════════ Via SSH/Terminal: ┌─────────────────────────────────────────────────────────────┐ │ cd /home/username/public_html │ │ php fix-symlinks.php │ │ chmod +x cpanel-setup.sh │ │ ./cpanel-setup.sh │ │ php artisan config:clear │ │ php artisan cache:clear │ └─────────────────────────────────────────────────────────────┘ Via cPanel File Manager (No SSH): ┌─────────────────────────────────────────────────────────────┐ │ 1. Delete: public/storage (if exists) │ │ 2. Create: public/storage (as folder) │ │ 3. Set permissions: 755 │ │ 4. Create: storage/app/public (if not exists) │ │ 5. Set permissions: 755 │ └─────────────────────────────────────────────────────────────┘ ═══════════════════════════════════════════════════════════════ ONE-LINE EMERGENCY FIX ═══════════════════════════════════════════════════════════════ rm -rf public/storage && mkdir -p public/storage storage/app/public && chmod -R 755 public/storage storage && php artisan config:clear ═══════════════════════════════════════════════════════════════ VERIFY FIX WORKED ═══════════════════════════════════════════════════════════════ ls -la public/ | grep storage ✅ GOOD: drwxr-xr-x (directory) ❌ BAD: lrwxrwxrwx (symlink) ═══════════════════════════════════════════════════════════════ FILES CREATED FOR YOU ═══════════════════════════════════════════════════════════════ Scripts: • fix-symlinks.php - Run after upload • cpanel-setup.sh - Complete setup • prepare-for-cpanel.bat - Run before upload (Windows) Docs: • FIX-SYMLINK-ERROR.md - Quick fix (READ THIS!) • CPANEL-DEPLOYMENT-GUIDE.md - Full guide • FIXES-APPLIED.md - What was changed Modified: • app/Providers/AppServiceProvider.php • app/Console/Commands/StorageLinkCommand.php • config/filesystems.php • .cpanel.yml ═══════════════════════════════════════════════════════════════ COMMON COMMANDS ═══════════════════════════════════════════════════════════════ Fix symlinks: php fix-symlinks.php Setup storage: php artisan storage:link Safe storage: php artisan storage:link-safe Clear config: php artisan config:clear Clear cache: php artisan cache:clear Check storage: ls -la public/storage ═══════════════════════════════════════════════════════════════ TROUBLESHOOTING ═══════════════════════════════════════════════════════════════ Error: symlink(): File exists Fix: rm -rf public/storage && mkdir public/storage Error: Permission denied Fix: chmod -R 755 storage public/storage bootstrap/cache Error: No such file Fix: mkdir -p storage/app/public public/storage Files don't show: Fix: php artisan config:clear && php artisan storage:link ═══════════════════════════════════════════════════════════════ KEY CHANGES ═══════════════════════════════════════════════════════════════ BEFORE: public/storage → symlink → storage/app/public ❌ Doesn't work on cPanel AFTER: public/storage = real directory (no symlink) ✅ Works perfectly on cPanel ═══════════════════════════════════════════════════════════════ IMPORTANT NOTES ═══════════════════════════════════════════════════════════════ ✓ NO symlinks are used anymore ✓ Files save directly to public/storage ✓ Auto-fix runs on every request ✓ Custom storage:link command (safe for cPanel) ✓ All deployment scripts included ═══════════════════════════════════════════════════════════════ Last Updated: 2025-11-14 Status: ✅ READY FOR DEPLOYMENT Tested: Laravel 10.x + cPanel/WHM ═══════════════════════════════════════════════════════════════