2016-05-16 9 views
1

私は最近Laravelの探索を開始しました。私は基本的なCRUD機能を備えた簡単なWebサイトを構築しようとしています。尋ねた同様の質問へSQLiteConnector.phpのInvalidArgumentException:データベース(storage/database.sqlite)が存在しません

InvalidArgumentException in SQLiteConnector.php line 34: 
    Database (storage/database.sqlite) does not exist. 
    in SQLiteConnector.php line 34 
    at SQLiteConnector->connect(array('driver' => 'sqlite', 'database' => 'storage/database.sqlite', 'prefix' => '', 'name' => 'sqlite')) in ConnectionFactory.php line 61 
    at ConnectionFactory->Illuminate\Database\Connectors\{closure}() 
    at call_user_func(object(Closure)) in Connection.php line 868 
    at Connection->getPdo() in Connection.php line 736 
    at Connection->reconnectIfMissingConnection() in Connection.php line 621 
    at Connection->run('select * from "certificates"', array(), object(Closure)) in Connection.php line 342 
    at Connection->select('select * from "certificates"', array(), true) in Builder.php line 1515 
    at Builder->runSelect() in Builder.php line 1501 
    at Builder->get(array('*')) in Builder.php line 596 
    at Builder->getModels(array('*')) in Builder.php line 303 
    at Builder->get(array('*')) in Model.php line 646 
    at Model::all() in certificatesController.php line 15 
    at CertificatesController->index() 
    at call_user_func_array(array(object(CertificatesController), 'index'), array()) in Controller.php line 80 
    at Controller->callAction('index', array()) in ControllerDispatcher.php line 146 
    at ControllerDispatcher->call(object(CertificatesController), object(Route), 'index') in ControllerDispatcher.php line 94 
    at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 
    at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 96 
    at ControllerDispatcher->callWithinStack(object(CertificatesController), object(Route), object(Request), 'index') in ControllerDispatcher.php line 54 
    at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\certificatesController', 'index') in Route.php line 174 
    at Route->runController(object(Request)) in Route.php line 140 
    at Route->run(object(Request)) in Router.php line 724 
    at Router->Illuminate\Routing\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 64 
    at VerifyCsrfToken->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in   ShareErrorsFromSession.php line 49 
    at ShareErrorsFromSession->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 62 
    at StartSession->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59 
    at EncryptCookies->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 
    at Pipeline->then(object(Closure)) in Router.php line 726 
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 699 
    at Router->dispatchToRoute(object(Request)) in Router.php line 675 
    at Router->dispatch(object(Request)) in Kernel.php line 246 
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 
    at CheckForMaintenanceMode->handle(object(Request), object(Closure)) 
    at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 136 
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32 
    at Pipeline->Illuminate\Routing\{closure}(object(Request)) 
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 
    at Pipeline->then(object(Closure)) in Kernel.php line 132 
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 99 
    at Kernel->handle(object(Request)) in index.php line 54 

ソリューションを:だからここコンテキストは、私がページ内のすべてのエントリのリストを表示できるようにしたいが、私はそのインデックスページを作成するときに、私は次の例外と会っていますということですStackoverflowで私のために働かなかった。基本的に、これらは今、私の.envとのconfig/database.phpでのファイルであるか、次のとおりです。

.env

DB_CONNECTION=sqlite 
    DB_HOST=localhost 
    DB_PORT=8888 
    DB_DATABASE=storage/database.sqlite 

のconfig/database.phpで

'default' => env('DB_CONNECTION', 'sqlite'), 
'sqlite' => [ 
      'driver' => 'sqlite', 
      'database' => env('DB_DATABASE', database_path('database.sqlite')), 
      'prefix' => '', 
      ], 

Iこれをローカルで実行しています(私はホームステッドではありません)、私はさまざまな値を何度か変更しようとしています(例えば、絶対パスを使用して、ポート番号を3306から8888に切り替えるなど)。誰かがこれを解決する方法に関するいくつかのアドバイスを提供できるかどうか本当に感謝します:)

ありがとう!

答えて

0

エラーメッセージは、保存フォルダ内の空のテキストファイルを作成し、database.sqliteをという名前を付けていることを確認してから、すでに私は `ストレージを持っていますphp artisan migrate

+0

/database.sqlite'ファイルを実行してください何storage/database.sqliteがないことを言います'php artisan migrate'を実行すると、次のメッセージが表示されます。「移行するものはありません。ターミナルで 'sqlite3 storage/database.sqlite'を実行すると、正常に動作しています。この問題が発生した理由は何ですか? – joychng

+0

'chmod -R o + w storage'を実行しましたか? –

+0

これを試してみましたが、どちらも動作しませんでした:( – joychng

関連する問題