Thomas Easo Thomas Easo - 1 year ago 68
PHP Question

How to install LARAVEL 5

how to install laravel on hostinger server/ any other free hosting server. I had learned and done working codes in localhost. But i would like to run it on a real server.

Laravel Version : 5

PHP Version Server :5.5.35

1) I had copied the full laravel code to "/home/< username >/"

2) copied the files in /home//laravel/public to /home/< username >/public_html

But it shows an error.

Fatal error: require(): Failed opening required '/home//public_html/../bootstrap/autoload.php' (include_path='.:/opt/php-5.5/pear') in /home//public_html/index.php on line 22

Answer :
Use Heroku Server as @lciamp Suggested in the comment

Clarification :

Please suggest me a list of Payed Servers which support Laravel Framework

Answer Source

Since you have SSH access do this:


  1. SSH into the server
  2. Change directory to the project root
    • cd /home/< username >
  3. delete the public_html folder
    • rm -rf public_html
  4. create a symbolic link from public to public_html
    • ln -s /home/< username >/public /home/< username >/public_html
  5. Install Laravel dependencies
    • composer install
  6. Change permissions
    • chmod -R 755 *
    • chmod -R 777 storage/ bootstrap/cache/


  1. Make sure your environment file uploaded and is proper.
  2. If the server is Apache, make sure you uploaded the .htaccess files.
  3. You probably uploaded all the assets, if so you will not need to do bower or npm.
  4. Restart the server.

**In Case of a Limited Shell Environment

  1. Install Laravel dependencies locally and upload the vendor folder with everything else.
  2. Instead of uploading the whole Laravel app to /home/< username >/ upload it to /home/< username >/public_html.
  3. Modify your /home/< username >/public_html/.htaccess to redirect all requests to the public subfolder.

    # /home/< username >/public_html/.htaccess
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        RewriteEngine On
        # Redirect All Requests To The Subfolder
        RewriteRule ^ /public
  4. Make sure you have the proper /home/< username >/public_html/public/.htaccess (GitHub).

    # /home/< username >/public_html/public/.htaccess
    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        RewriteEngine On
        # Redirect Trailing Slashes If Not A Folder...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)/$ /$1 [L,R=301]
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
        # Handle Authorization Header
        RewriteCond %{HTTP:Authorization} .
        RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]