Php 如何在附加域内安装laravel

Php 如何在附加域内安装laravel,php,mysql,laravel,laravel-5,Php,Mysql,Laravel,Laravel 5,我的项目名称是yadavarpro 我在public\u html后面创建了一个yadavarpro文件夹,并复制了除public之外的所有文件夹 (我无法在StackOverflow上上载图像!) 如下图所示: 我在public\u html中创建了另一个yadavarpro文件夹,并复制了public文件夹的所有内容 如下图所示: 但是我的网站显示了一个白色的屏幕。我想我应该改变引导配置。 但我不知道 您肯定需要公共目录及其所有内容。只要加载项域指向公共的laravel目录,它就可以正常

我的项目名称是
yadavarpro

我在
public\u html
后面创建了一个
yadavarpro
文件夹,并复制了除
public
之外的所有文件夹

(我无法在StackOverflow上上载图像!)

如下图所示:

我在
public\u html
中创建了另一个
yadavarpro
文件夹,并复制了
public
文件夹的所有内容

如下图所示:

但是我的网站显示了一个白色的屏幕。我想我应该改变引导配置。 但我不知道


您肯定需要公共目录及其所有内容。只要加载项域指向公共的laravel目录,它就可以正常工作。

您所做的是非常不正常的,但是您可能会欺骗laravel接受它(可能不值得尝试)

我将参考laravel引导过程中的两个重要文件:和

基本上,在索引中有两个对
\uuuuu DIR\uuuu.../bootstrap“
(一个用于自动加载程序,一个用于应用程序)的引用,您需要更改它们以找到实际的引导位置。在您当前的结构中,如果我理解正确,可能是:
\uuuu DIR\uuu.../yadavarpro/bootstrap“

在应用程序引导程序中,您需要执行以下操作:

$app = new Illuminate\Foundation\Application(
    realpath(__DIR__.'/../')
);
$app->instance("path.public",__DIR__."../../public_html"); //Basically overwrite the public path with whatever the correct one is.
这假设任何需要获取公共路径的人都将始终通过
public\u path
app()->make(“path.public”)
获取公共路径,并且永远不要假设它只是
基本路径(“public”)
,但是在Laravel的任何部分或其中的任何模块中都不太可能实现此假设,所以请小心。

我解决了:

编辑
index.php
内部
public\u html/yadavarpro

使用:


您必须将公用文件夹的所有内容直接复制到您的公用html文件夹,包括.htaccess
公用目录是什么意思<代码>公用\u html
公用
文件夹?我应该将我的
public
文件夹中的所有内容复制到
public\u html
?我指的是laravel应用程序中的公共目录。您可能会删除public_html并将域的webroot指向public/而不是。
<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

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

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

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

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);
<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

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

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

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

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);