Php Laravel 5.4在重新安装后抛出500错误
资料:Php Laravel 5.4在重新安装后抛出500错误,php,laravel-5.4,Php,Laravel 5.4,资料: Php version 7.1 已安装的所有扩展: OpenSSL PHP Extension PDO PHP Extension Mbstring PHP Extension Tokenizer PHP Extension XML PHP Extension 已尝试运行: composer dump-autoload composer clear-cache artisan clear:cache artisan config:Cache 错误日志中的错误: PHP分析错误:语
Php version 7.1
已安装的所有扩展:
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
已尝试运行:
composer dump-autoload
composer clear-cache
artisan clear:cache
artisan config:Cache
错误日志中的错误:
PHP分析错误:语法错误,意外的“类”(T_类),
应为标识符(T_字符串)或变量(T_变量)或“{”或“$”
在第50行的/home/username/laravel/public/index.php中
访问站点时:HTTP错误500
有什么想法吗
编辑1:
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__.'/../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);
?>
服务器使用MultiHP Manager,因此为了使用php版本7.1,我必须使用所选的php版本(/opt/cpanel/ea-php71/root/usr/bin/php)我的web服务器使用我的旧php版本5。要解决此问题,请尝试 sudo a2dismod php5 sudo a2enmod php7.0
sudo service apache2 restart解决方案是与我的主机提供商联系,将PHP版本更改为>=5.6.4。您的index.PHP文件有问题
require __DIR__.'/../bootstrap/autoload.php';
在这一行中,您必须用vendor替换此引导,因为laravel 5.6将自动加载文件存储在vendor文件夹中,而不是bootstrap文件夹中
请删除引导程序并添加供应商,然后运行
composer dump autoload命令
,然后尝试访问:)您可以向我们展示index.php文件的内容并告诉我们您是如何进行新安装的吗?@JoffreyCarle updated检查您的php版本,因为在$kernel=$app->make(light\Contracts\Http\kernel::class)行中;::类方法无法解析,我认为您的php版本>5。1@VaheGalstyan通过命令opt/cpanel/ea-php71/root/user/bin/php-v
返回PHP7.1.5,您可以在index.php文件的第一行添加var_dump(phpversion());die;,并显示结果
require __DIR__.'/../bootstrap/autoload.php';