How to install LARAVEL 5
Asked Answered
A

2

-3

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

Assembler answered 21/6, 2016 at 12:32 Comment(11)
Here: laravel.com/docs/master#installing-laravelStylobate
don't think he has cli access so the doc's wont help himCharisecharisma
Laravel can't (officially) be setup in a subdirectory of the host root. You will need to set up a virtual host (something that I doubt is possible with free hosting). You could follow medium.com/@kunalnagar/… to see if it helps.Buckle
here is how to do it on heroku. It's actually really easy after you delete the env.example file. shohan.net/2015/12/07/…Sensuality
@ThomasEaso '/home//public_html/ is not a valid directory. Where is your username?Bosporus
Save yourself a lot of time and headache and just use a VPS.Devitalize
It's probably permission issue. Add read permissions to bootstrap/autoload.php if you have accessDinh
@Bosporus Username is there its considered as a tag by stackoverflow.Assembler
@RavishaHesh It is already having read permission for user,owner, group(rw-r--r--). Do i need to provide other permission using chmod ??. i can access chmod through SSHAssembler
Try with 755 permissionsDinh
Problem Solved : Best answer .Your Solution works. @Sensuality Post your answer. i will make it the best answerAssembler
B
0

Since you have SSH access do this:

Filesystem

  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/

Checklist

  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
        </IfModule>
    
        RewriteEngine On
    
        # Redirect All Requests To The Subfolder
        RewriteRule ^ /public
    
    </IfModule>
    
  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
        </IfModule>
    
        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}]
    </IfModule>
    
Bosporus answered 21/6, 2016 at 16:29 Comment(3)
You answer is correct but it wont work for my hosting provider they don't have all these function (rm,ln,composer) *FREE Suggest a hosting provider on which i can test and learn laravel on free real server is also an answerAssembler
clear,exit,arch,bzip2,cal,cksum,cmp,cp,crontab,basename,cd,chmod,ls,date,df,du,dos2unix,unix2dos,file,getfacl,gzip,head,hostid,tail,mkdir,mv,nslookup,sdiff,uptime,whois These are the commands they provide for SSHAssembler
To my knowledge there are not free server hosting options. The Homestead vagrant box is a real server that runs locally and there is no reason you cannot learn with that. I believe I have answered your question to the fullest. Good luck to you.Bosporus
H
0

After you copy the code to your hosting server, you need to install the composer packages required to run Laravel. You can do this using composer install (providing that composer is installed). Otherwise, you need to install composer first.

Hexapartite answered 21/6, 2016 at 15:12 Comment(3)
He is trying it on shared or free hosting which has no shell access. So, how come he will run composer?Hillis
@MuhammadSumonMollaSelim He should run the composer installation on his local, and upload the vendor directory. Or, frankly, he should get off shared hosting entirely.Bluebottle
@Bluebottle as me mentioned "I had learned and done working codes in localhost." locally, he is ready. yes, agree! no shared hosting.Hillis
B
0

Since you have SSH access do this:

Filesystem

  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/

Checklist

  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
        </IfModule>
    
        RewriteEngine On
    
        # Redirect All Requests To The Subfolder
        RewriteRule ^ /public
    
    </IfModule>
    
  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
        </IfModule>
    
        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}]
    </IfModule>
    
Bosporus answered 21/6, 2016 at 16:29 Comment(3)
You answer is correct but it wont work for my hosting provider they don't have all these function (rm,ln,composer) *FREE Suggest a hosting provider on which i can test and learn laravel on free real server is also an answerAssembler
clear,exit,arch,bzip2,cal,cksum,cmp,cp,crontab,basename,cd,chmod,ls,date,df,du,dos2unix,unix2dos,file,getfacl,gzip,head,hostid,tail,mkdir,mv,nslookup,sdiff,uptime,whois These are the commands they provide for SSHAssembler
To my knowledge there are not free server hosting options. The Homestead vagrant box is a real server that runs locally and there is no reason you cannot learn with that. I believe I have answered your question to the fullest. Good luck to you.Bosporus

© 2022 - 2024 — McMap. All rights reserved.