Laravel运行出错RuntimeException No application encryption key has been specified.

在项目根目录放置.env文件 APP_NAME=Laravel APP_ENV=local APP_KEY= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=homestead DB_USERNAME=homestead DB_PASSWORD=secret BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file SESSION_LIFETIME=120 QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= 在项目目录下运行: php artisan key:generate 该命令会生成APP_KEY并写入到.env文件中,重新运行

January 5, 2018 · 1 min · ZhaoGuibin

Laravel访问出错错误信息:`Warning require(vendorautoload.php) failed to open stream No such file or dire

Warning: require(/opt/project/erp_api/public/../vendor/autoload.php): failed to open stream: No such file or directory in /opt/project/erp_api/public/index.php on line 24 Fatal error: require(): Failed opening required ‘/opt/project/erp_api/public/../vendor/autoload.php’ (include_path=’.:’) in /opt/project/erp_api/public/index.php on line 24 原因:网站根目录下缺少vendor这个存放laraver依赖包的目录 解决方法:使用composer install进行安装 (没有安装过的情况下,以前安装过的话使用:composer update)

January 5, 2018 · 1 min · ZhaoGuibin