![使用 Google App Engine 进行 Laravel 部署:没有此文件或目录](https://linux22.com/image/705079/%E4%BD%BF%E7%94%A8%20Google%20App%20Engine%20%E8%BF%9B%E8%A1%8C%20Laravel%20%E9%83%A8%E7%BD%B2%EF%BC%9A%E6%B2%A1%E6%9C%89%E6%AD%A4%E6%96%87%E4%BB%B6%E6%88%96%E7%9B%AE%E5%BD%95.png)
我已经关注这教程并创建了一个名为的数据库zoho_portal
。我的app.yaml
内容是:
runtime: php
env: flex
runtime_config:
document_root: public
# required on some platforms so ".env" is not skipped
skip_files: false
env_variables:
# The values here will override those in ".env". This is useful for
# production-specific configuration. However, feel free to set these
# values in ".env" instead if you prefer.
APP_LOG: errorlog
STORAGE_DIR: /tmp
CACHE_DRIVER: database
SESSION_DRIVER: database
## Set these environment variables according to your CloudSQL configuration.
DB_HOST: localhost
DB_DATABASE: zoho_portal
DB_USERNAME: USER
DB_PASSWORD: PASS
DB_SOCKET: /cloudsql/zoho-portal-159018:us-central1:zoho-portal
beta_settings:
cloud_sql_instances: "zoho-portal-159018:us-central1:zoho-portal"
我还将其添加到我的composer.json
:
"post-deploy-cmd": [
"chmod -R 755 bootstrap\/cache"
]
但是,使用 部署后gcloud app deploy
,访问以下网站:https://zoho-portal-159018.appspot.com/,我收到此错误:
SQLSTATE[HY000] [2002] 没有该文件或目录 (SQL: select * from
sessions
whereid
= iq8isoeEqTaj5xVNmVm0JuFKtR8vtSEB0ajJl23o limit 1)
据我所知,我没有错过教程中列出的任何步骤,并且数据库设置正确。这可能与数据库迁移有关吗?
答案1
答案2
我也遇到了同样的问题,但添加DB_CONNECTION: mysql
到env_variables
我的版本中app.yaml
就解决了这个问题。