Dragon Arrow written by Tatsuya Nakaji, all rights reserved animated-dragon-image-0164

cakePHP3.6でディレクトリを移行した後に生じた謎エラー

updated on 2019-04-20

作業ディレクトリ変更後の謎エラー


経緯: デスクトップからUSBに訳あって移動していたのだが、久しぶりに必要になりデスクトップに持ってきて開くとエラーが...



$ bin/cake server
failed to open stream: No such file or directory in /作業ディレクトリ/アプリ名/config/bootstrap.php on line 19
PHP Fatal error:  require(): Failed opening required '/作業ディレクトリ/アプリ名/config/paths.php'


え、何もファイルいじってないのになぜにエラーが...


原因: なんと、config配下のpaths.phpがなくなっているではないか!なぜ勝手に消えているのだ?!

そして、path.phpを新規作成してサーバーを起動すると、無事に治ったのだ!あジャバ、不思議な不思議なエラーでした  



root_path/config/paths.php
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link          https://cakephp.org CakePHP(tm) Project
* @since         3.0.0
* @license       MIT License (https://opensource.org/licenses/mit-license.php)
*/

/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}

/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
* When using custom settings be sure to use the DS and do not add a trailing DS.
*/

/**
* The full path to the directory which holds "src", WITHOUT a trailing DS.
*/
define('ROOT', dirname(__DIR__));

/**
* The actual directory name for the application directory. Normally
* named 'src'.
*/
define('APP_DIR', 'src');

/**
* Path to the application's directory.
*/
define('APP', ROOT . DS . APP_DIR . DS);

/**
* Path to the config directory.
*/
define('CONFIG', ROOT . DS . 'config' . DS);

/**
* File path to the webroot directory.
*/
define('WWW_ROOT', ROOT . DS . 'webroot' . DS);

/**
* Path to the tests directory.
*/
define('TESTS', ROOT . DS . 'tests' . DS);

/**
* Path to the temporary files directory.
*/
define('TMP', ROOT . DS . 'tmp' . DS);

/**
* Path to the logs directory.
*/
define('LOGS', ROOT . DS . 'logs' . DS);

/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP . 'cache' . DS);

/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
* CakePHP should always be installed with composer, so look there.
*/
define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'vendor' . DS . 'cakephp' . DS . 'cakephp');

/**
* Path to the cake directory.
*/
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
define('CAKE', CORE_PATH . 'src' . DS);