I have Laravel 12 project (PHP, Inertia, ReactJS and Tailwind) project that I need to deploy to a cPanel shared server. I do not have SSH access to the server, and the service provider does not give SSH access.

Checking across different solutions, there does not seem to be a definitive guide on how to achieve this. Is it even possible to do?

5 Replies 5

They probably provide FTP access for you to copy the necessary files from your dev/test environment to the server.

What do you need SSH/terminal access for, specifically?

From the documents that I have gone through, the deployment process involves running a few php artisan commands on the cPanel server.

Uploading the files to the server is not a problem

Sorry you'll have to bear with me as I'm not a Laravel expert, but are you absolutely sure you need to run those in the live environment - you can't just deploy ready-made files and database and run it, like any other PHP application?

What are the exact commands you're expecting to have to run? Is it related to database migrations? If so there will be ways to avoid that, I think e.g. dump the database SQL out and re-import it via phpmyadmin. There are quite a lot of suggestions online about this.

Ultimately if you think you really can't do this without the terminal access then your options are to contact the service provider and see if there's any option to enable that, or if not then you'll have to move to provider that does offer that, and/or consider using a VPS instead.

Most artisan commands you need to run are related to database, probably migrations. You can run them locally, but that won't affect the database on the server.

You always have the option to manually create a database and its tables in cPanel with phpMyAdmin (for starter kits in Laravel there are less than a dozen of them so not much work).

As for the frontend files, you need to build them first using npm run build and that's basically the only command you have to run locally in order to deploy to a server where you don't have access to terminal. This command builds your components to static HTML, CSS and JavaScript files

You might have a problem with targeting your index.php file with some hosting providers, but I say you'll cross that bridge when you get there.

Just to add to Stevan's reply: if you're using Vite, any variables with the VITE_ prefix are statically replaced at build time. So if you build locally, the build will use your local VITE_ variables not the server’s .env. Make sure the correct values are set before building.

Your Reply

By clicking “Post Your Reply”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.