Tuesday, April 19, 2016

Run Laravel Migrate on shared hosting

Hello everyone,

Had a project where we were using Laravel to build a small website. Turns out it is hosted on "shared hosting" without SSH to run command line commands to use Migrations or Seed.

After some research on the web, I found you can run the console commands from within routes. But this means having a route that could potential screw up the site.

But since it was possible I put together a tiny script that setup the console and runs the commands:

Now all that is needed it so upload the install.php script into the public folder, call it with www.my-site-url.com/install.php, and after it is finish delete it.

It's very important that the file is deleted after finishing.

You can find here how to configure Laravel on shared hosting. It's for version 4 but still applies to version 5.

No comments:

Post a Comment