alishaukat February 2016

Laravel website on a shared webhost that does not provide any shell?

I have a laravel 5 site on my localhost. I want to launch it on a shared host but the host is neither providing me with the shell nor it has composer installed. Can I still launch my website on this host? If yes then how? If the answer is no then what should I do?

Answers


Adam February 2016

You can but you need to upload your local directory after a composer install, including vendor and .env using and FTP client. I wouldn't recommend it though, it makes development really hard. Maybe look into a paas like Heroku to get you started for free.

You also need to make sure that the shared hosting supports the following:

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension

as take from the docs


Zahan Safallwa February 2016

Yes you can upload via file manager if you wish. Follow below steps

  1. Check the server configuration of PHP 5.4 (this because every little change on .htaccess file may change that config)

  2. Create a directory in the same level of public_html and put your project inside that folder (except public folder).

  3. Put the content of public (L5) directly on public_html (don't overwrite the .htaccess file)

Inside public_html all files of public directory of Laravel 5 resides now.

Go to index.php and edit the line 22

#From this
require __DIR__.'/../bootstrap/autoload.php';
#To this
require __DIR__.'/../[framework-folder]/bootstrap/autoload.php';

and on line 36

#From this 
$app = require_once __DIR__.'/../bootstrap/app.php';
#To this
$app = require_once __DIR__.'/../[framework-folder]/bootstrap/app.php';

Then edit the .htaccess file and add some lines

RewriteEngine On
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_URI} !^
RewriteRule ^(.*)$ /$1 [L]  

Hope this works. Worked for me.

Post Status

Asked in February 2016
Viewed 1,554 times
Voted 7
Answered 2 times

Search




Leave an answer