>백엔드 개발 >PHP 튜토리얼 >在服务器上部署 Laravel 工程

在服务器上部署 Laravel 工程

WBOY
WBOY원래의
2016-06-06 20:17:161541검색

用 Laravel 框架写了一个工程,已经在本机测试好了,准备部署到一台外网服务器(阿里云的)。

目前这台服务器操作系统是 Ubuntu 12.04,装了 PHP 5.6.18,根据 JellyBool 的帖子 进行了 Nginx 配置,访问后是 Laravel 的出错页面,如下:

在服务器上部署 Laravel 工程

看了一下 larval.log 中的 log,内容如下:

<code>    [2016-02-25 10:24:42] production.ERROR: exception 'ReflectionException' with message 'Class App\Http\Controllers\OfficialWebsiteController does not exist' in /var/www/shark/vendor/illuminate/routing/Route.php:264
    Stack trace:
    #0 /var/www/shark/vendor/illuminate/routing/Route.php(264): ReflectionMethod->__construct('App\\Http\\Contro...', 'index')
    #1 /var/www/shark/vendor/illuminate/routing/Router.php(838): Illuminate\Routing\Route->signatureParameters('Illuminate\\Data...')
    #2 /var/www/shark/vendor/illuminate/routing/Router.php(823): Illuminate\Routing\Router->substituteImplicitBindings(Object(Illuminate\Routing\Route))
    #3 /var/www/shark/vendor/illuminate/routing/Router.php(806): Illuminate\Routing\Router->substituteBindings(Object(Illuminate\Routing\Route))
    #4 /var/www/shark/vendor/illuminate/routing/Router.php(670): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
    #5 /var/www/shark/vendor/illuminate/routing/Router.php(654): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
    #6 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
    #7 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
    #8 /var/www/shark/vendor/illuminate/routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #9 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #10 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
    #11 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
    #12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
    #13 /var/www/shark/vendor/illuminate/routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #14 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #15 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #16 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
    #17 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
    #18 /var/www/shark/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
    #19 {main}  
  </code>

执行过 composer dump-autoload,提示一行绿字 Generating autoload files,没有成功失败提示。

另外,php 没有启用 openssl,尝试启用但是遇到一些麻烦,不知道目前是否有必要,暂时没有启用。

回复内容:

用 Laravel 框架写了一个工程,已经在本机测试好了,准备部署到一台外网服务器(阿里云的)。

目前这台服务器操作系统是 Ubuntu 12.04,装了 PHP 5.6.18,根据 JellyBool 的帖子 进行了 Nginx 配置,访问后是 Laravel 的出错页面,如下:

在服务器上部署 Laravel 工程

看了一下 larval.log 中的 log,内容如下:

<code>    [2016-02-25 10:24:42] production.ERROR: exception 'ReflectionException' with message 'Class App\Http\Controllers\OfficialWebsiteController does not exist' in /var/www/shark/vendor/illuminate/routing/Route.php:264
    Stack trace:
    #0 /var/www/shark/vendor/illuminate/routing/Route.php(264): ReflectionMethod->__construct('App\\Http\\Contro...', 'index')
    #1 /var/www/shark/vendor/illuminate/routing/Router.php(838): Illuminate\Routing\Route->signatureParameters('Illuminate\\Data...')
    #2 /var/www/shark/vendor/illuminate/routing/Router.php(823): Illuminate\Routing\Router->substituteImplicitBindings(Object(Illuminate\Routing\Route))
    #3 /var/www/shark/vendor/illuminate/routing/Router.php(806): Illuminate\Routing\Router->substituteBindings(Object(Illuminate\Routing\Route))
    #4 /var/www/shark/vendor/illuminate/routing/Router.php(670): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
    #5 /var/www/shark/vendor/illuminate/routing/Router.php(654): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
    #6 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(246): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
    #7 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
    #8 /var/www/shark/vendor/illuminate/routing/Pipeline.php(52): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #9 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #10 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
    #11 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
    #12 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
    #13 /var/www/shark/vendor/illuminate/routing/Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #14 [internal function]: Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
    #15 /var/www/shark/vendor/illuminate/pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
    #16 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
    #17 /var/www/shark/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(99): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
    #18 /var/www/shark/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
    #19 {main}  
  </code>

执行过 composer dump-autoload,提示一行绿字 Generating autoload files,没有成功失败提示。

另外,php 没有启用 openssl,尝试启用但是遇到一些麻烦,不知道目前是否有必要,暂时没有启用。

OfficialWebsiteController does not exist
反射这个控制器,没有找到,看看是不是命名大小写的问题

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.