2017-06-13 93 views
0

信息:安装Laravel 5.4抛出500错误后重新安装

Php version 7.1 

所有分机:

OpenSSL PHP Extension 
PDO PHP Extension 
Mbstring PHP Extension 
Tokenizer PHP Extension 
XML PHP Extension 

试图运行:

PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/username/laravel/public/index.php on line 50

composer dump-autoload 
composer clear-cache 
artisan clear:cache 
artisan config:Cache 

在错误日志中的错误

当访问网站:HTTP错误500

任何想法?

编辑1:公共

内容/ index.php文件

<?php 

/** 
* Laravel - A PHP Framework For Web Artisans 
* 
* @package Laravel 
* @author Taylor Otwell <[email protected]> 
*/ 

/* 
|-------------------------------------------------------------------------- 
| 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); 

?> 

我如何安装laravel:

通过SSH登录到服务器。 cd /home/username/

// Download composer & install & unistall 

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" 
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" 
php composer-setup.php 
php -r "unlink('composer-setup.php');" 

// Download laravel 

/opt/cpanel/ea-php71/root/usr/bin/php /home/username_here/composer.phar create-project --prefer-dist laravel/laravel 

// Create soft link 

rm -rf public_html 
ln -s laravel/public/ public_html 


// Change ownership permissions 

chown -R username_here:username_here /home/username_here/laravel 
chown -R username_here:username_here /home/username_here/public_html 

// Generate a key 

/opt/cpanel/ea-php71/root/usr/bin/php /home/username_here/laravel/artisan key:generate 

Server使用MultiPHP经理这样才能使用的PHP 7.1版,我必须使用选择的PHP版本(/选择/的cPanel/EA-php71 /根的/ usr/bin中/ PHP)

+0

您能告诉我们您的index.php文件的内容并告诉您如何进行全新安装? –

+0

@JoffreyCarle更新 –

+1

检查你的PHP版本,因为在$ kernel = $ app-> make(Illuminate \ Contracts \ Http \ Kernel :: class); :: class方法无法解析,我认为你的php版本> 5.1 –

回答

0

我用我的旧的PHP版本是Web服务器5.要解决它尝试

须藤a2dismod PHP5 须藤a2enmod php7.0 须藤服务的Apache2重启

0

的解决办法是用我的托管提供联系r并将PHP版本更改为> = 5.6.4。