我已经关注这教程并创建了一个名为的数据库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
就解决了这个问题。