XAMPP環境にCakePHP4インストール時に起きたエラーと解決方法

You must enable the intl extension to use CakePHP. ~~ requirements.php on line 31

Fatal error: You must enable the intl extension to use CakePHP. in C:\xampp\htdocs\my_app\config\requirements.php on line 31

解決方法

「php.ini」にある以下のコメントを開放してXAMPP再起動

;extension=intl

extension=intl
Cake公式

No such file or directory ~~ index.php on line 31

Warning: require(C:\xampp\htdocs\my_app/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\my_app\webroot\index.php on line 31

Fatal error: require(): Failed opening required 'C:\xampp\htdocs\my_app/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\my_app\webroot\index.php on line 31

解決方法

自分のCakePHPアプリのディレクトリに移動して以下

composer update

An Internal Error Has Occurred.

An Internal Error Has Occurred.
Error: An Internal Error Has Occurred.

Back

原因究明方法

まずは、
[config/app.php]のデバッグレベルを以下のように変更

    /*
     * Debug Level:
     *
     * Production Mode:
     * false: No error messages, errors, or warnings shown.
     *
     * Development Mode:
     * true: Errors and warnings shown.
     */
    'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),

そうすると、原因がわかる

Security::setSalt() must be of the type string, null given, called in~~

Argument 1 passed to Cake\Utility\Security::setSalt() must be of the type string, null given, called in C:\xampp\htdocs\my_app\config\bootstrap.php on line 166

解決方法

[config/app.php]のSecurityのenvの第二引数に32文字以上のランダムな文字を入れておけばよい

    /*
     * Security and encryption configuration
     *
     * - salt - A random string used in security hashing methods.
     *   The salt value is also used as the encryption key.
     *   You should treat it as extremely sensitive data.
     */
    'Security' => [
        'salt' => env('SECURITY_SALT', 'dfc123c6c22d84f4bc12273f3df67c6ae55009696e4126b36ac2f755778faccc'),
    ],

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です