前提・実現したいこと
HerokuにCakePHPで作ったものをHerokuで表示できるようにしたいと思っています。
デプロイすることはできましたが、DebugKitが読み込めない、とのことで、次のサイトを参考にしました。
https://teratail.com/questions/166094
結果として、ローカルで同じ問題が起きていて、ローカルは解決したのですが、Herokuで、
Please replace src/Template/Pages/home.ctp with your own version or re-enable debug mode. Error: The requested address '/' was not found on this server.
上記のようなエラーが発生していて、表示できません。
次に下記のサイトを参考にしましたが
https://qiita.com/uedatakeshi/items/9712cd4632209389445a
同じエラーになります。
上記のエラーは解決しましたが、次に
Error: An Internal Error Has Occurred.
上記のエラーが発生しました。
調べたらデータベースの設定がおかしいというエラーらしいのですが、
ローカルで使っていたDBではダメなのでしょうか?
HerokuでDBを作らないといけないのでしょうか?
助けて下さい。お願いします。
発生している問題・エラーメッセージ
Error: An Internal Error Has Occurred.
該当のソースコード
php
1composer.json 2 3{ 4 "name": "cakephp/app", 5 "description": "CakePHP skeleton app", 6 "homepage": "https://cakephp.org", 7 "type": "project", 8 "license": "MIT", 9 "require": { 10 "php": ">=5.6", 11 "cakephp/cakephp": "3.7.*", 12 "cakephp/migrations": "^2.0.0", 13 "cakephp/plugin-installer": "^1.0", 14 "mobiledetect/mobiledetectlib": "2.*", 15 "tecnick.com/tcpdf":"*" 16 }, 17 "require-dev": { 18 "cakephp/bake": "^1.9.0", 19 "cakephp/cakephp-codesniffer": "^3.0", 20 "cakephp/debug_kit": "^3.17.0", 21 "josegonzalez/dotenv": "3.*", 22 "phpunit/phpunit": "^5|^6", 23 "psy/psysh": "@stable", 24 "heroku/heroku-buildpack-php": "*" 25 }, 26 "suggest": { 27 "markstory/asset_compress": "An asset compression plugin which provides file concatenation and a flexible filter system for preprocessing and minification.", 28 "dereuromark/cakephp-ide-helper": "After baking your code, this keeps your annotations in sync with the code evolving from there on for maximum IDE and PHPStan compatibility." 29 }, 30 "autoload": { 31 "psr-4": { 32 "App\": "src/" 33 } 34 }, 35 "autoload-dev": { 36 "psr-4": { 37 "App\Test\": "tests/", 38 "Cake\Test\": "vendor/cakephp/cakephp/tests/" 39 } 40 }, 41 "scripts": { 42 "post-install-cmd": "App\Console\Installer::postInstall", 43 "post-create-project-cmd": "App\Console\Installer::postInstall", 44 "post-autoload-dump": "Cake\Composer\Installer\PluginInstaller::postAutoloadDump", 45 "check": [ 46 "@test", 47 "@cs-check" 48 ], 49 "cs-check": "phpcs --colors -p --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/", 50 "cs-fix": "phpcbf --colors --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/", 51 "test": "phpunit --colors=always" 52 }, 53 "prefer-stable": true, 54 "config": { 55 "sort-packages": true 56 } 57} 58
php
1app_heroku.php 2 3<?php 4$db = parse_url(env('CLEARDB_DATABASE_URL')); 5return[ 6 'debug' => false, 7 'Security' => [ 8 'salt' => env('SALT'), 9 ], 10 'Datasources' => [ 11 'default' => [ 12 'className' => 'Cake\Database\Connection', 13 'driver' => 'Cake\Database\Driver\Mysql', 14 'persistent' => false, 15 'host' => $db['host'], 16 'username' => $db['user'], 17 'password' => $db['pass'], 18 'database' => substr($db['path'],1), 19 'encoding' => 'utf8', 20 //'timezone' => 'UTC', 21 'cacheMetadata' => true, 22 'quoteIdentifiers' => false, 23 ], 24 ], 25 'EmailTransport' => [ 26 'default' => [ 27 'className' => 'Smtp', 28 // The following keys are used in SMTP transports 29 'host' => 'ssl://' . $smtp['host'], 30 'port' => $smtp['port'], 31 'timeout' => 30, 32 'username' => $smtp['user'], 33 'password' => $smtp['pass'], 34 'client' => null, 35 'tls' => null, 36 ], 37 ], 38 'Log' => [ 39 'debug' => [ 40 'className' => 'Cake\Log\Engine\ConsoleLog', 41 'stream' => 'php://stdout', 42 'levels' => ['notice', 'info', 'debug'], 43 ], 44 'error' => [ 45 'className' => 'Cake\Log\Engine\ConsoleLog', 46 'stream' => 'php://stderr', 47 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], 48 ], 49 ], 50]; 51 ?> 52
試したこと
上記に書いてあるサイトの内容は殆ど試しました。
何度も修正してデプロイを繰り返しています。
補足情報(FW/ツールのバージョンなど)
Mac, MAMP, PHP7.2