我刚将我的应用程序部署到我的服务器上。我压缩了整个应用程序文件夹并将其上传到我的服务器。我还导出了我的应用程序的数据库表,并将其导入我的服务器phpmyadmin。我已配置.env
设置,但当我尝试访问我的应用时,它会引发服务器错误500.我的应用程序位于mywebsite.com/app/
所有文件都位于应用程序文件夹中。我还试图将公共文件移到public_html
,但它仍无效。
.env文件:
APP_ENV=local
APP_DEBUG=true
APP_KEY=base64:keyofmyapp
APP_URL=http://mywebsite.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=username
DB_PASSWORD='password'
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
日志:
[14-Apr-2016 19:35:44 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:36:40 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:38:21 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:38:27 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:38:47 UTC] PHP Warning: require_once(/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php): failed to open stream: No such file or directory in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:38:47 UTC] PHP Fatal error: require_once(): Failed opening required '/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:41:40 UTC] PHP Warning: require_once(/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php): failed to open stream: No such file or directory in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:41:40 UTC] PHP Fatal error: require_once(): Failed opening required '/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:41:44 UTC] PHP Warning: require_once(/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php): failed to open stream: No such file or directory in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:41:44 UTC] PHP Fatal error: require_once(): Failed opening required '/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:42:40 UTC] PHP Warning: require_once(/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php): failed to open stream: No such file or directory in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:42:40 UTC] PHP Fatal error: require_once(): Failed opening required '/home/ushrzaka/public_html/mywebsite.com/pos/public/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ushrzaka/public_html/mywebsite.com/pos/index.php on line 21
[14-Apr-2016 19:43:15 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:43:17 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:43:19 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:45:11 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:45:15 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:45:17 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:45:26 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:46:22 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:48:27 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:50:35 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:52:03 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:52:05 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:56:40 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
[14-Apr-2016 19:56:49 UTC] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/ushrzaka/public_html/mywebsite.com/pos/public/index.php on line 50
答案 0 :(得分:1)
好像你正在使用PHP< 5.5。 Laravel 5.2需要PHP 5.5.9版本,并且在index.php的第50行查看:
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
在PHP 5.5中添加了
所以你应该验证你的PHP版本。它可能是5.4或更早