简体   繁体   中英

setting up laravel 5.2 in a sub doamin at a shared hosting server

I want to deploy laravel 5.2 into a sub domain named sub but i get the following error

Unable to handle the request
HTTP ERROR 50

I have researhed and found that i require php version 5.5.9 and above in order for laravel to run. I have laravel 5.5, but When i place laravel "public" folder contents into the shared host "public_html" folder it works but when i place the same content into my sub domain its not working.

i have also changed the index.php as follows

require __DIR__.'/../sub/bootstrap/autoload.php';

$app = require_once __DIR__.'/../sub/bootstrap/app.php';

After you meet the server requirements , You only need to point your subdomain to the public directory of your laravel project directory.

eg if your domain is enaveed.com , your subdomain is flipflop.enaveed.com and your project is in /public_html/flipflop directory, this is how you need to configure your subdomain in a standard cpanel environment:

标准cpanel视图

First, you should met the server requirement: https://laravel.com/docs/5.2/installation#server-requirements

Second, you should upload all the files of laravel into your public_html

Third, change the name of server.php to index.php

fourth, copy .htaccess file from laravel "public" folder to your public_html

require __DIR__.'/../sub/bootstrap/autoload.php';

$app = require_once __DIR__.'/../sub/bootstrap/app.php';

Those paths look wrong.

  • First, Copy everything except public folder in your root folder(preferably not in public_html but one level up, so people cannot access them) and give a name to folder. Let's say the folder name is laravel.
  • Copy your public folder in to your public folder(public_html), then, rename it to "sub". So you can access it by http://www.yourwebsite.com/sub .
  • in index.html file in your sub folder, change the paths like below.

    require DIR .'/../../laravel/bootstrap/autoload.php';
    $app = require_once DIR .'/../../laravel/bootstrap/app.php';

    • Go to bootstrap/app.php file, then change below

$app = new Illuminate\\Foundation\\Application(
realpath( DIR .'/../')
);

to

$app = new Illuminate\Foundation\Application(
  realpath(__DIR__.'/../../laravel/')
);
  • Go to Bootstrap/autoload.php file and change

    require DIR .'/../vendor/autoload.php';

to

require __DIR__.'/../../laravel/vendor/autoload.php';  

It should work now.
(PS I don't like this markdown typing. it shows some of my codes in block but does not some of them)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM