我在运行现有Laravel 5.3项目的开发机器上通过composer安装了Roumen \ Sitemap,并设置了服务提供商&中间件路由。这一切在我的开发环境中都很有用。
我上传了以下文件&通过FTP将文件夹发送到网络服务器。
/Http/Kernel.php (added ''sitemap' => '\App\Http\Middleware\Sitemap',' to the protected $middleware variable)
/config/sitemap.php
/config/app.php // (added Roumen\Sitemap\SitemapServiceProvider::class)
/public // (for some vendor views and assets)
/Http/routes.php // (just for retrieving the sitemap)
/Http/Middleware/Sitemap.php
为了确定,我运行了sudo chmod -R 777供应商和sudo chmod -R 777存储
但我收到错误:
production.ERROR: exception 'ErrorException' with message 'file_put_contents(myproject/bootstrap/cache/services.php): failed to open stream: Permission denied' in /myproject/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:111
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/myproject/la...', 111, Array)
#1 /myproject/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(111): file_put_contents('/myproject/...', '<?php return ar...', 0)
#2 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(190): Illuminate\Filesystem\Filesystem->put('/myproject/la...', '<?php return ar...')
#3 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(135): Illuminate\Foundation\ProviderRepository->writeManifest(Array)
#4 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(60): Illuminate\Foundation\ProviderRepository->compileManifest(Array)
#5 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(530): Illuminate\Foundation\ProviderRepository->load(Array)
#6 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#7 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(232): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(127): Illuminate\Foundation\Http\Kernel->bootstrap()
#10 /myproject/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#11 /myproject/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#12 {main}
我忘记了什么吗?
答案 0 :(得分:0)
'ErrorException' with message 'file_put_contents(myproject/bootstrap/cache/services.php):
failed to open stream: Permission denied'
很明显,bootstrap/cache
文件夹中的权限不正确。
轻松修复:sudo chown -R www-data:www-data /myproject/bootstrap/cache