Laravel不在主机中运行
我有一个在本地主机上运行良好的laravel项目。但是在传输到主机之后,会出现以下错误。它运行了几分钟,但几次之后错误就被执行了 当前无法处理此请求。HTTP错误500 在错误日志中发现以下错误Laravel不在主机中运行,laravel,Laravel,我有一个在本地主机上运行良好的laravel项目。但是在传输到主机之后,会出现以下错误。它运行了几分钟,但几次之后错误就被执行了 当前无法处理此请求。HTTP错误500 在错误日志中发现以下错误 [14-Oct-2018 11:26:33 Asia/Tehran] PHP Warning: include(/home/httprami/public_html/local/vendor/composer/../laravel/framework/src/Illuminate/Filesystem
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Warning:
include(/home/httprami/public_html/local/vendor/composer/../laravel/framework/src/Illuminate/Filesystem/Filesystem.php): failed to open stream: No such file or directory in /home/httprami/public_html/local/vendor/composer/ClassLoader.php on line 444
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Stack trace:
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 1. {main}() /home/httprami/public_html/index.php:0
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 2. require_once() /home/httprami/public_html/index.php:38
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 3. Illuminate\Foundation\Application->__construct() /home/httprami/public_html/local/bootstrap/app.php:15
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 4. Illuminate\Foundation\Application->registerBaseBindings() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:144
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 5. spl_autoload_call() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 6. Composer\Autoload\ClassLoader->loadClass() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 7. Composer\Autoload\includeFile() /home/httprami/public_html/local/vendor/composer/ClassLoader.php:322
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Warning: include(/home/httprami/public_html/local/vendor/composer/../laravel/framework/src/Illuminate/Filesystem/Filesystem.php): failed to open stream: No such file or directory in /home/httprami/public_html/local/vendor/composer/ClassLoader.php on line 444
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Stack trace:
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 1. {main}() /home/httprami/public_html/index.php:0
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 2. require_once() /home/httprami/public_html/index.php:38
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 3. Illuminate\Foundation\Application->__construct() /home/httprami/public_html/local/bootstrap/app.php:15
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 4. Illuminate\Foundation\Application->registerBaseBindings() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:144
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 5. spl_autoload_call() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 6. Composer\Autoload\ClassLoader->loadClass() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 7. Composer\Autoload\includeFile() /home/httprami/public_html/local/vendor/composer/ClassLoader.php:322
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Warning: include(): Failed opening '/home/httprami/public_html/local/vendor/composer/../laravel/framework/src/Illuminate/Filesystem/Filesystem.php' for inclusion (include_path='.:/opt/alt/php72/usr/share/pear') in /home/httprami/public_html/local/vendor/composer/ClassLoader.php on line 444
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Stack trace:
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 1. {main}() /home/httprami/public_html/index.php:0
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 2. require_once() /home/httprami/public_html/index.php:38
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 3. Illuminate\Foundation\Application->__construct() /home/httprami/public_html/local/bootstrap/app.php:15
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 4. Illuminate\Foundation\Application->registerBaseBindings() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:144
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 5. spl_autoload_call() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 6. Composer\Autoload\ClassLoader->loadClass() /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
[14-Oct-2018 11:26:33 Asia/Tehran] PHP 7. Composer\Autoload\includeFile() /home/httprami/public_html/local/vendor/composer/ClassLoader.php:322
[14-Oct-2018 11:26:33 Asia/Tehran] PHP Fatal error: Uncaught Error: Class 'Illuminate\Filesystem\Filesystem' not found in /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:175
Stack trace:
#0 /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(144): Illuminate\Foundation\Application->registerBaseBindings()
#1 /home/httprami/public_html/local/bootstrap/app.php(15): Illuminate\Foundation\Application->__construct('/home/httpramin...')
#2 /home/httprami/public_html/index.php(38): require_once('/home/httpramin...')
#3 {main}
thrown in /home/httprami/public_html/local/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 175
解决方案是什么?首先,在共享托管中,使用公共html设置项目会更好、更安全。您的laravel公用文件夹必须作为公用html使用 如您所见,php警告非常清晰,无法找到路径:
/home/httprami/public_html/local/vendor/composer/../laravel/framework/src/Illuminate/Filesystem/Filesystem.php
我发现您将项目放在“本地”文件夹中,所以您是否更新了公用文件夹中的index.php,如下所示:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../local/bootstrap/app.php';;
到
public/index.php第22行和第36行中有以下两行
有关如何在共享主机上部署laravel项目的更多信息,请在我打印路径时检查,它与文件的路径相同。请检查
/home/httprami/public\u html/local/vendor/composer/。/laravel/framework/src/light/Filesystem/Filesystem.php的真实位置,并验证路径是否正确。我编辑数据库连接信息。保存后网站不会运行您上面提到的问题与数据库无关,laravel将向您显示有关数据库连接的真实错误消息。我编辑数据库连接信息。保存后网站不会运行
require __DIR__.’/../local/bootstrap/autoload.php’;
$app = require_once __DIR__.'/../local/bootstrap/app.php';