Laravel構成ロード問題レコード
Laravel構成ロード問題レコード
前言
Laravelの構成ロードによる問題が発生しました.ページのヒント:
表示ログ(
サポートされているencrypterが見つからないか、keyが正しくありません.この問題とAPP_KEY関係.
APP_KEYって何?
すなわち、このkeyは、フレームワーク内のencrypt(暗号化)サービス、例えばユーザのセッション、クッキーなどを格納し、情報の安全を確保するためのランダム文字列である.このkeyは、
の準備を
使用サーバーの表示
表示:Apache
サイト所在ディレクトリ
位置:/www/wwwroot/
apacheプロファイルの表示
プロファイル:conf/http.conf
phpを表示します.ini位置
位置:/www/server/php/56/etc/php.ini
プロセス
ネット上では以下の解決策にすぎない.実行 構成appを変更する.cipherはAES-256-CBCである、keyを生成して手動で置換.env
試しても、効果はありません.
エラーを報告したファイル
$keyがnullであることがわかりました
PHPシステムの関数
php.ini:
そこで,この関数を解禁する.composerが使えます.しかし、プロファイルの問題は依然として存在します.
apacheを再起動してみます.
いずれも役に立たない.
次にapacheプロファイルを表示します.
既存の知識ではapacheはPHP-moduleでリクエストを転送すべきである.しかしここではphp-fpmを用いた.
php-fpmを再起動
ページをリフレッシュし、問題を解決します.
まとめ
問題 php-fpmのapacheを使用するには、php-fpmを再起動することによってのみ、プロファイルを有効にすることができます.
リファレンス Laravel No supported encrypter found. The cipher and/or key length are invalid No supported encrypter found. The cipher and/or key length are invalid apacheプロファイルパス の表示方法 No supported encrypter found. The cipher and/or key length are invalid.
前言
Laravelの構成ロードによる問題が発生しました.ページのヒント:
Whoops, looks like something went wrong.
表示ログ(
tail -f storage/logs/laravel.log
)の表示:production.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in ...vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:45
サポートされているencrypterが見つからないか、keyが正しくありません.この問題とAPP_KEY関係.
APP_KEYって何?
すなわち、このkeyは、フレームワーク内のencrypt(暗号化)サービス、例えばユーザのセッション、クッキーなどを格納し、情報の安全を確保するためのランダム文字列である.このkeyは、
php artisan key:generate
により更新することができる.の準備を
使用サーバーの表示
> losf -i :80
表示:Apache
サイト所在ディレクトリ
> loate
位置:/www/wwwroot/
apacheプロファイルの表示
> httpd -V|grep 'SERVER_CONFIG_FILE'
プロファイル:conf/http.conf
phpを表示します.ini位置
> php --ini
位置:/www/server/php/56/etc/php.ini
プロセス
ネット上では以下の解決策にすぎない.
php artisan key:generate
再生成APP_KEY 試しても、効果はありません.
エラーを報告したファイル
EncryptionServiceProvider.php:45
にブレークポイントを追加します.protected function getEncrypterForKeyAndCipher($key, $cipher)
{
dd($key, $cipher); // $key = null
if (Encrypter::supported($key, $cipher)) {
return new Encrypter($key, $cipher);
} elseif (McryptEncrypter::supported($key, $cipher)) {
return new McryptEncrypter($key, $cipher);
} else {
throw new RuntimeException('No supported encrypter found. The cipher and / or key length are invalid.');
}
}
$keyがnullであることがわかりました
composer info
を実行して依存を確認します.ヒント:Warning: putenv() has been disabled for security reasons in...
PHPシステムの関数
putenv
が無効になった疑いがあり、結果として生じる.Env構成はフレームワークで読み込めません.php.ini:
; disable_functions = passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
そこで,この関数を解禁する.composerが使えます.しかし、プロファイルの問題は依然として存在します.
apacheを再起動してみます.
> apachectl restart
> httpd reload
> killall httpd && httpd
いずれも役に立たない.
次にapacheプロファイルを表示します.
.
.
.
#PHP
SetHandler "proxy:unix:/tmp/php-cgi-56.sock|fcgi://localhost"
.
.
.
既存の知識ではapacheはPHP-moduleでリクエストを転送すべきである.しかしここではphp-fpmを用いた.
php-fpmを再起動
> killall php-fpm
> php-fpm
ページをリフレッシュし、問題を解決します.
まとめ
問題
リファレンス