0๐
โ
So it turns out there was a new line before <?php in one of my files in app/config !!
Almost drove me crazy. Worked fine on localhost but not on server. If you encounter this issue, check your .php files for new lines at the beginning of the file.
0๐
For me, deleting the files in /bootstrap/cache folder except the .gitignore
then running the command composer dumpautoload
worked
Source:stackexchange.com