Reputation: 47
I have an web application with PHP Laravel frontend and Postgress SQL backend. I have deployed this application to google app engine flex environment. After deployment to app engine, getting following error after login from the site. The application runs fine on my local environment after login when pointed the database to google cloud SQL postgress database.
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
Here is my app.yaml file
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"
Upvotes: 0
Views: 217
Reputation: 12470
That error sounds awfully like Google App Engine is running PHP 7.2+ and your code is incompatible with it. 7.2 introduced some changes to the semantics of the count()
function so look into this change and specifically at your own uses of the function to confirm it's being used correctly.
Upvotes: 1