我有一个带有PHP Laravel前端和Postgress SQL后端的Web应用程序。我已经将此应用程序部署到了Google App Engine Flex环境。部署到App Engine后,从网站登录后出现以下错误。将数据库指向google cloud 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"
答案 0 :(得分:1)
这个错误听起来非常像Google App Engine正在运行PHP 7.2+,并且您的代码与此不兼容。 7.2对count()
函数的语义进行了一些更改,因此请仔细研究此更改,特别是您自己对函数的使用以确认其正确使用。