我想更新env文件中的数据库密码。我想更新db_password
变量。
导航到/var/www/html
php artisan env:set db_password=myPassWordHere
和我得到的错误。
PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
完全错误
PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array)
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundati in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
如何使用命令行更新env文件中的db_password变量?
答案 0 :(得分:1)
检查日志文件是否存在并且具有写权限:
ls -l /var/www/html/storage/logs/laravel.log
如果它不可写,请运行:
chmod 755 /var/www/html/storage/logs/laravel.log
答案 1 :(得分:1)
您可以使用Github软件包
https://github.com/svenluijten/flex-env
成功安装软件包后
例如
如果要向.env文件添加新的常量
如果要添加值为ADMIN_EMAIL
的{{1}}
admin@app.com