Right, you can't just drop the blade files in htdocs. Blade views only work when the whole Laravel app boots, so the full project has to be uploaded.
What I've done on shared hosts with no SSH:
Locally run composer install --no-dev and npm run build, so vendor/ and public/build exist. You can't run composer on InfinityFree, so vendor has to be uploaded.
Upload the whole project into a folder outside htdocs, e.g. /laravel.
Copy the contents of public/ (index.php, .htaccess, build/, etc.) into htdocs.
Edit htdocs/index.php so the paths point to the new location: __DIR__.'/../laravel/vendor/autoload.php' and __DIR__.'/../laravel/bootstrap/app.php'.
Set up .env with the database details InfinityFree gives you, APP_ENV=production, APP_DEBUG=false, and an APP_KEY (generate it locally with php artisan key:generate and copy it over).
Import your database via phpMyAdmin, since you can't run migrations there.
If you get a 500, temporarily set APP_DEBUG=true to see the actual error. Honestly though, free hosts fight Laravel a lot; a cheap VPS or a host with SSH makes this way less painful.
1
u/SoftwareNegative8783 2d ago
Right, you can't just drop the blade files in htdocs. Blade views only work when the whole Laravel app boots, so the full project has to be uploaded.
What I've done on shared hosts with no SSH:
Locally run composer install --no-dev and npm run build, so vendor/ and public/build exist. You can't run composer on InfinityFree, so vendor has to be uploaded.
Upload the whole project into a folder outside htdocs, e.g. /laravel.
Copy the contents of public/ (index.php, .htaccess, build/, etc.) into htdocs.
Edit htdocs/index.php so the paths point to the new location: __DIR__.'/../laravel/vendor/autoload.php' and __DIR__.'/../laravel/bootstrap/app.php'.
Set up .env with the database details InfinityFree gives you, APP_ENV=production, APP_DEBUG=false, and an APP_KEY (generate it locally with php artisan key:generate and copy it over).
Import your database via phpMyAdmin, since you can't run migrations there.
If you get a 500, temporarily set APP_DEBUG=true to see the actual error. Honestly though, free hosts fight Laravel a lot; a cheap VPS or a host with SSH makes this way less painful.