Php 未定义索引:Laravel中的时区
我已经在运行MAMP的Mac上本地开发了一个Laravel项目。我有一份Git回购协议。我已尝试在部署服务器上进行Git Clone、Composer更新,但得到以下输出:Php 未定义索引:Laravel中的时区,php,git,laravel,Php,Git,Laravel,我已经在运行MAMP的Mac上本地开发了一个Laravel项目。我有一份Git回购协议。我已尝试在部署服务器上进行Git Clone、Composer更新,但得到以下输出: smpuser@ssmpuser:/var/www/recruitment-v2$ composer update Loading composer repositories with package information Updating dependencies (including require-dev) -
smpuser@ssmpuser:/var/www/recruitment-v2$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing stack/builder (dev-master f98a5eb)
Downloading: 100%
- Removing phpseclib/phpseclib (dev-master 268ec2e)
- Installing phpseclib/phpseclib (dev-master 211e237)
Downloading: 100%
- Removing monolog/monolog (dev-master d81ca5a)
- Installing monolog/monolog (dev-master 7f783c0)
Downloading: 100%
- Removing nikic/php-parser (dev-master 0353c92)
- Installing nikic/php-parser (dev-master bf9956b)
Downloading: 100%
- Removing predis/predis (0.8.x-dev 0f01b89)
- Installing predis/predis (0.8.x-dev 5f2eea6)
Downloading: 100%
- Removing laravel/framework (4.1.x-dev 6e246f3)
- Installing laravel/framework (4.1.x-dev 24c9aaf)
Downloading: connection... Downloading: 100%
Writing lock file
Generating autoload files
{"error":{"type":"ErrorException","message":"Undefined index: timezone","file":"\/var\/www\/recruitment-v2\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/start.php","line":167}}{"error":{"type":"ErrorException","message":"Undefined index: timezone","file":"\/var\/www\/recruitment-v2\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/start.php","line":167}}
我已经在3台服务器上尝试过了,但都遇到了同样的问题,我正在运行PHP5.3.10
有人能提出解决办法吗
这是我的start.php,它与Laravel捆绑在一起
app.php:
<?php
return array(
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => true,
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://x.x.co.uk',
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => 'U6rUNcyOZASCypuYCZAB5CGvWaNkjcEm',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Session\CommandsServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Routing\ControllerServiceProvider',
'Illuminate\Cookie\CookieServiceProvider',
'Illuminate\Database\DatabaseServiceProvider',
'Illuminate\Encryption\EncryptionServiceProvider',
'Illuminate\Filesystem\FilesystemServiceProvider',
'Illuminate\Hashing\HashServiceProvider',
'Illuminate\Html\HtmlServiceProvider',
'Illuminate\Log\LogServiceProvider',
'Illuminate\Mail\MailServiceProvider',
'Illuminate\Database\MigrationServiceProvider',
'Illuminate\Pagination\PaginationServiceProvider',
'Illuminate\Queue\QueueServiceProvider',
'Illuminate\Redis\RedisServiceProvider',
'Illuminate\Remote\RemoteServiceProvider',
'Illuminate\Auth\Reminders\ReminderServiceProvider',
'Illuminate\Database\SeedServiceProvider',
'Illuminate\Session\SessionServiceProvider',
'Illuminate\Translation\TranslationServiceProvider',
'Illuminate\Validation\ValidationServiceProvider',
'Illuminate\View\ViewServiceProvider',
'Illuminate\Workbench\WorkbenchServiceProvider',
),
/*
|--------------------------------------------------------------------------
| Service Provider Manifest
|--------------------------------------------------------------------------
|
| The service provider manifest is used by Laravel to lazy load service
| providers which are not needed for each request, as well to keep a
| list of all of the services. Here, you may set its storage spot.
|
*/
'manifest' => storage_path().'/meta',
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
'Auth' => 'Illuminate\Support\Facades\Auth',
'Blade' => 'Illuminate\Support\Facades\Blade',
'Cache' => 'Illuminate\Support\Facades\Cache',
'ClassLoader' => 'Illuminate\Support\ClassLoader',
'Config' => 'Illuminate\Support\Facades\Config',
'Controller' => 'Illuminate\Routing\Controller',
'Cookie' => 'Illuminate\Support\Facades\Cookie',
'Crypt' => 'Illuminate\Support\Facades\Crypt',
'DB' => 'Illuminate\Support\Facades\DB',
'Eloquent' => 'Illuminate\Database\Eloquent\Model',
'Event' => 'Illuminate\Support\Facades\Event',
'File' => 'Illuminate\Support\Facades\File',
'Form' => 'Illuminate\Support\Facades\Form',
'Hash' => 'Illuminate\Support\Facades\Hash',
'HTML' => 'Illuminate\Support\Facades\HTML',
'Input' => 'Illuminate\Support\Facades\Input',
'Lang' => 'Illuminate\Support\Facades\Lang',
'Log' => 'Illuminate\Support\Facades\Log',
'Mail' => 'Illuminate\Support\Facades\Mail',
'Paginator' => 'Illuminate\Support\Facades\Paginator',
'Password' => 'Illuminate\Support\Facades\Password',
'Queue' => 'Illuminate\Support\Facades\Queue',
'Redirect' => 'Illuminate\Support\Facades\Redirect',
'Redis' => 'Illuminate\Support\Facades\Redis',
'Request' => 'Illuminate\Support\Facades\Request',
'Response' => 'Illuminate\Support\Facades\Response',
'Route' => 'Illuminate\Support\Facades\Route',
'Schema' => 'Illuminate\Support\Facades\Schema',
'Seeder' => 'Illuminate\Database\Seeder',
'Session' => 'Illuminate\Support\Facades\Session',
'SSH' => 'Illuminate\Support\Facades\SSH',
'Str' => 'Illuminate\Support\Str',
'URL' => 'Illuminate\Support\Facades\URL',
'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View',
),
);
是否在php.ini中设置时区?例如:
date.timezone = Europe/Rome
添加日期默认时区设置(“欧洲/伦敦”);在主页顶部或构造函数内部(如果您使用的是类)。我可以通过省略app/config/
目录中的配置文件来重现该错误:
如果您碰巧遇到了该文件中的config变量dd()
,您会注意到它是空的
在使用git
和试图忽略所需配置文件夹部分的分支时,我遇到了同样的问题
我建议您仔细检查该文件夹中的设置以及与该文件夹相关的任何.gitignore
规则。如果您缺少这些文件,请确保手动下载它们并将它们放在app/config/
目录中
我希望这能给你指明正确的方向,因为我完全被这个错误迷住了。你能发布你的start.php
的代码吗?它是基础的Laravel start.php,我没有修改它。在上面的帖子中包括它。你能从config
目录发布你的app.php
吗?包括app.php,谢谢!是的,它设定在欧洲/伦敦,这似乎不是问题。谢谢你,伙计!这救了我的命。
date.timezone = Europe/Rome