繁体   English   中英

Laravel 项目部署给出 HTTP ERROR 500

[英]Laravel project deployment gives the HTTP ERROR 500

在您假设之前,我确实阅读了有关此问题的所有其他帖子,但我无法找到解决问题的方法。

所以问题是,无论我在我的网络主机上上传我的文件和文件夹,我都会得到相同的结果,给我“目前无法处理这个请求。HTTP 错误 500”。 我正在使用 000webhostapp。

于是我把项目在我的根目录“/”,public的内容上传到public_html项目,它给了我上面的文字。 然后我尝试将我的整个项目移动到 public_html(public 是它自己在 public_html 中的目录),它给了我相同的结果。 我已经尝试了一些带有 .htaccess 文件的解决方案,但无论我尝试过什么都不会让它起作用。 在我的 localhost 项目中安装的方式有点像“htdocs/kola/..”,但在网络托管上它只是在根目录中,没有其他目录(我认为这可能会有所帮助,但我无法使用)。 因此,经过 30 个小时的尝试并重新上传该项目 5 次后,仍然无法使其正常工作,如果有人甚至可以尝试帮助我解决此问题,我将不胜感激。

提前致谢

正确的方法是进入您文件夹的根目录...即/home/并为您的项目创建一个文件夹。 然后将项目的所有内容移动到此文件夹中,除了公用文件夹。 现在转到public_html文件夹并在那里添加 public 文件夹的所有内容。

更新您的index.php如下:

<?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__.'/../(name of your root folder)/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__.'/../(name of your root folder)/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);

配置.env文件并拥有正确的数据库配置。

不需要创建新目录。 只需删除 index.php 文件的内容并粘贴上面的代码并将您的(根文件夹的名称)替换为 public_html。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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