困っていること
php artisan migrate
このコマンドを叩きたいのですが、エラーがでてしまいます。解決したいです。
## エラーの内容
PHP Fatal error: Uncaught Error: Class 'Illuminate\Container\Container' not found in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:29 Stack trace: #0 /var/www/vendor/composer/ClassLoader.php(444): include() #1 /var/www/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/var/www/vendor...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('Illuminate\Foun...') #3 /var/www/bootstrap/app.php(14): spl_autoload_call('Illuminate\Foun...') #4 /var/www/artisan(20): require_once('/var/www/bootst...') #5 {main} thrown in /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 29
ソースコード
.env
APP_ENV=development DB_CONNECTION=development DB_HOST_DEV=mysql DB_PORT_DEV=3306 DB_DATABASE_DEV=default DB_USERNAME_DEV=default DB_PASSWORD_DEV=secret APP_KEY=base64:i0/u98UueJrM0anjTd4RtbLlRbzZ8B77L7Fta8FYcyA= APP_DEBUG=false
php
1<?php 2 3use Illuminate\Support\Str; 4 5$DB_CONNECTION = env('APP_ENV') === 'production' ? 'production' : 'development'; 6 7return [ 8 9 /* 10 |-------------------------------------------------------------------------- 11 | Default Database Connection Name 12 |-------------------------------------------------------------------------- 13 | 14 | Here you may specify which of the database connections below you wish 15 | to use as your default connection for all database work. Of course 16 | you may use many connections at once using the Database library. 17 | 18 */ 19 20 'default' => $DB_CONNECTION, 21 22 /* 23 |-------------------------------------------------------------------------- 24 | Database Connections 25 |-------------------------------------------------------------------------- 26 | 27 | Here are each of the database connections setup for your application. 28 | Of course, examples of configuring each database platform that is 29 | supported by Laravel is shown below to make development simple. 30 | 31 | 32 | All database work in Laravel is done through the PHP PDO facilities 33 | so make sure you have the driver for your particular database of 34 | choice installed on your machine before you begin development. 35 | 36 */ 37 38 'connections' => [ 39 40 'development' => [ 41 'driver' => 'mysql', 42 // 'url' => env('DATABASE_URL_DEV'), 43 'host' => env('DB_HOST_DEV', '127.0.0.1'), 44 'port' => env('DB_PORT_DEV', '3306'), 45 'database' => env('DB_DATABASE_DEV', 'forge'), 46 'username' => env('DB_USERNAME_DEV', 'forge'), 47 'password' => env('DB_PASSWORD_DEV', ''), 48 'unix_socket' => env('DB_SOCKET_DEV', ''), 49 'charset' => 'utf8mb4', 50 'collation' => 'utf8mb4_unicode_ci', 51 'prefix' => '', 52 'prefix_indexes' => true, 53 'strict' => true, 54 'engine' => null, 55 'options' => extension_loaded('pdo_mysql') ? array_filter([ 56 PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 57 ]) : [], 58 ], 59 60 'production' => [ 61 'driver' => 'mysql', 62 // 'url' => env('DATABASE_URL'), 63 'host' => env('DB_HOST', '127.0.0.1'), 64 'port' => env('DB_PORT', '3306'), 65 'database' => env('DB_DATABASE', 'forge'), 66 'username' => env('DB_USERNAME', 'forge'), 67 'password' => env('DB_PASSWORD', ''), 68 'unix_socket' => env('DB_SOCKET', ''), 69 'charset' => 'utf8mb4', 70 'collation' => 'utf8mb4_unicode_ci', 71 'prefix' => '', 72 'prefix_indexes' => true, 73 'strict' => true, 74 'engine' => null, 75 'options' => extension_loaded('pdo_mysql') ? array_filter([ 76 PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 77 ]) : [], 78 ], 79 80 // 'sqlite' => [ 81 // 'driver' => 'sqlite', 82 // 'url' => env('DATABASE_URL'), 83 // 'database' => env('DB_DATABASE', database_path('database.sqlite')), 84 // 'prefix' => '', 85 // 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 86 // ], 87 88 // 'mysql' => [ 89 // 'driver' => 'mysql', 90 // 'url' => env('DATABASE_URL'), 91 // 'host' => env('DB_HOST', '127.0.0.1'), 92 // 'port' => env('DB_PORT', '3306'), 93 // 'database' => env('DB_DATABASE', 'forge'), 94 // 'username' => env('DB_USERNAME', 'forge'), 95 // 'password' => env('DB_PASSWORD', ''), 96 // 'unix_socket' => env('DB_SOCKET', ''), 97 // 'charset' => 'utf8mb4', 98 // 'collation' => 'utf8mb4_unicode_ci', 99 // 'prefix' => '', 100 // 'prefix_indexes' => true, 101 // 'strict' => true, 102 // 'engine' => null, 103 // 'options' => extension_loaded('pdo_mysql') ? array_filter([ 104 // PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 105 // ]) : [], 106 // ], 107 108 // 'pgsql' => [ 109 // 'driver' => 'pgsql', 110 // 'url' => env('DATABASE_URL'), 111 // 'host' => env('DB_HOST', '127.0.0.1'), 112 // 'port' => env('DB_PORT', '5432'), 113 // 'database' => env('DB_DATABASE', 'forge'), 114 // 'username' => env('DB_USERNAME', 'forge'), 115 // 'password' => env('DB_PASSWORD', ''), 116 // 'charset' => 'utf8', 117 // 'prefix' => '', 118 // 'prefix_indexes' => true, 119 // 'schema' => 'public', 120 // 'sslmode' => 'prefer', 121 // ], 122 123 // 'sqlsrv' => [ 124 // 'driver' => 'sqlsrv', 125 // 'url' => env('DATABASE_URL'), 126 // 'host' => env('DB_HOST', 'localhost'), 127 // 'port' => env('DB_PORT', '1433'), 128 // 'database' => env('DB_DATABASE', 'forge'), 129 // 'username' => env('DB_USERNAME', 'forge'), 130 // 'password' => env('DB_PASSWORD', ''), 131 // 'charset' => 'utf8', 132 // 'prefix' => '', 133 // 'prefix_indexes' => true, 134 // ], 135 136 ], 137 138 /* 139 |-------------------------------------------------------------------------- 140 | Migration Repository Table 141 |-------------------------------------------------------------------------- 142 | 143 | This table keeps track of all the migrations that have already run for 144 | your application. Using this information, we can determine which of 145 | the migrations on disk haven't actually been run in the database. 146 | 147 */ 148 149 'migrations' => 'migrations', 150 151 /* 152 |-------------------------------------------------------------------------- 153 | Redis Databases 154 |-------------------------------------------------------------------------- 155 | 156 | Redis is an open source, fast, and advanced key-value store that also 157 | provides a richer body of commands than a typical key-value system 158 | such as APC or Memcached. Laravel makes it easy to dig right in. 159 | 160 */ 161 162 'redis' => [ 163 164 'client' => env('REDIS_CLIENT', 'phpredis'), 165 166 'options' => [ 167 'cluster' => env('REDIS_CLUSTER', 'redis'), 168 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 169 ], 170 171 'default' => [ 172 'url' => env('REDIS_URL'), 173 'host' => env('REDIS_HOST', '127.0.0.1'), 174 'password' => env('REDIS_PASSWORD', null), 175 'port' => env('REDIS_PORT', '6379'), 176 'database' => env('REDIS_DB', '0'), 177 ], 178 179 'cache' => [ 180 'url' => env('REDIS_URL'), 181 'host' => env('REDIS_HOST', '127.0.0.1'), 182 'password' => env('REDIS_PASSWORD', null), 183 'port' => env('REDIS_PORT', '6379'), 184 'database' => env('REDIS_CACHE_DB', '1'), 185 ], 186 187 ], 188 189];
どのようなコードを見るべきかわかりません。
## 試したこと
mysqlコンテナが立ち上がっていないみたいでしたので,
こちらの記事を参考に解決を試みましたが、解決できずにいます。
くわしいかた、教えていただきたいです。
回答1件
あなたの回答
tips
プレビュー