【发布时间】:2019-07-18 07:11:34
【问题描述】:
我有一个带有 PHP Laravel 前端和 Postgress SQL 后端的 Web 应用程序。我已将此应用程序部署到 google app engine flex 环境。部署到应用引擎后,从站点登录后出现以下错误。登录后,当将数据库指向谷歌云 SQL postgress 数据库时,应用程序在我的本地环境中运行良好。
Error:
count(): Parameter must be an array or an object that implements Countable
in 57369c716dc79e4b8bf3c1b292b0f7eb440a33da.php line 35
at HandleExceptions->handleError('2', 'count(): Parameter must be an array or an object that implements Countable', '/app/storage/framework/views/57369c716dc79e4b8bf3c1b292b0f7eb440a33da.php', '35', array('__path' => '/app/storage/framework/views/57369c716dc79e4b8bf3c1b292b0f7eb440a33da.php', '__data' => array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'obLevel' => '2', 'data' => object(stdClass)), 'obLevel' => '3', '__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'data' => object(stdClass))) in 57369c716dc79e4b8bf3c1b292b0f7eb440a33da.php line 35
这是我的 app.yaml 文件
runtime: php
env: flex
runtime_config:
document_root: public
skip_files:
- .env
env_variables:
# Put production environment variables here.
APP_LOG: errorlog
APP_KEY: xxxxxxxxxxxxxxxxxxxxxxxxxx
STORAGE_DIR: /tmp
DB_DRIVER: 'pgsql'
DB_CONNECTION: pgsql
DB_HOST: <ipaddress of cloud sql db>
DB_PORT: 5432
DB_DATABASE: dbname
DB_USERNAME: xxxxxxx
DB_PASSWORD: xxyyzz
DB_SOCKET: "/cloudsql/xxx:xyz:yxz"
REDIS_HOST: localhost
REDIS_PASSWORD : null
REDIS_PORT: 6379
beta_settings:
cloud_sql_instances: "xyz:xyzz:instance=tcp:5432"
【问题讨论】:
-
可能是您从本地开发环境中复制了一些文件,您只需要使用
php artisan view:clear和php artisan cache:clear清除视图和缓存。如果您无法运行控制台命令,则只需删除storage/framework/views/中的所有文件
标签: php laravel postgresql google-app-engine google-cloud-platform