Laravel项目部署提供HTTP ERROR 500

时间:2018-03-16 12:20:09

标签: php laravel

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

所以事情就是这样,然而无论我在我的网络主机上传文件和文件夹,我都会得到相同的结果,让我得到#34;目前无法处理此请求。 HTTP ERROR 500"。我使用的是000webhostapp。

所以我将项目上传到我的根目录" /",将公众的内容上传到了public_html项目,它给了我上面的文字。然后我尝试将整个项目移动到public_html(public是public_html中的公共目录),它给了我相同的结果。我已经尝试过.htaccess文件的一些解决方案,但无论我尝试过什么都不能使它工作。在我的localhost项目安装有点像这样" htdocs / kola /..",但在网络托管它只是在根目录,没有其他目录(我觉得这可能会有所帮助)但我无法使用)。因此,经过30个小时的尝试和重新上载项目5次后,仍然无法使其正常工作,如果有人甚至可以尝试帮助我,我会感激不尽。

提前致谢

2 个答案:

答案 0 :(得分:0)

The right way is to get to the root of your folder..ie /home/ and create a folder for your project. 
Then move the all the contents of your project into this folder except the public folder. 
Now go to the public_hml folder and add all the contents of the public folder there. Update your index.php as below
<?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);

-Configure the .env file and have the right database configuration.

答案 1 :(得分:0)

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