The error happened when I set up drupal7 at the install page on the last step. I've tried most ways mentioned in the issue and all failed: https://www.drupal.org/node/481758. But this didn't happend with drupal8 (all other things are the same). It seems that PHP7.1 is too new for drupal7.

Error: Call to undefined function field_attach_load() in DrupalDefaultEntityController->attachLoad() (line 354 of /var/www/drupal7/includes/entity.inc).

Environment:
ubuntu: 16.04
PHP: 7.1
Drupal: 7.53
nginx: 1.10.0

Comments

I_cecreamX created an issue. See original summary.

cilefen’s picture

What is the exact version of PHP?

Divya Pandey’s picture

I have researched this and related issues and found just drop and recreate the database as utf8_general_ci solve the problem

isantolin’s picture

@cilefen i have the same error with this configuration
PHP 7.0.13
MySQL 5.7.17-0ubuntu0.16.04.1
Apache 2.4.18

isantolin’s picture

Same error with PHP 5.5.9-1ubuntu4.20, Apache version 2.4.7, MySQL 5.5.54-0ubuntu0.14.04.1 on Drupal Setup

[Sat Feb 11 21:27:00.600010 2017] [:error] [pid 1594] [client 201.6.143.56:33268] PHP Fatal error: Call to undefined function field_attach_load() in /home/ignacio/www/includes/entity.inc on line 354, referer: http://host.com/install.php?profile=standard&locale=en

Anyone can fix that error?

isantolin’s picture

Priority: Normal » Critical
cilefen’s picture

Status: Active » Closed (duplicate)

This issue is a duplicate of #481758: Fatal error: Call to undefined function field_attach_load() in includes/entity.inc on line 321 during install, which itself may be a duplicate of other issues. Please move the conversation there.

cilefen’s picture

Title: Drupal7 has a problem with PHP7.1 while setting up » Fatal error: Call to undefined function field_attach_load() in /home/ignacio/www/includes/entity.inc on line 354 during installation
Status: Closed (duplicate) » Active
cilefen’s picture

Title: Fatal error: Call to undefined function field_attach_load() in /home/ignacio/www/includes/entity.inc on line 354 during installation » Fatal error: Call to undefined function field_attach_load() in entity.inc on line 354 during installation

I am curious about the opcache configuration.

amit0212’s picture

Patch

I had to:

1. Delete the existing mysql database: drop database drupal7xdev;
2. Create the mysql database: create database drupal7xdev;
3. Run install.php again

*note that I chose to name my database 'drupal7xdev', your database will undoubtedly be named something different.

**note!!! This was a new installation, if you have an existing site, please do NOT drop your database unless you want to lose all your data!!!!!!!!! (you've been warned)

isantolin’s picture

@cilefen opcache disabled, Same error

joseph.olstad’s picture

probably need to add this patch: https://www.drupal.org/node/1525176#comment-6317632
to this issue and trigger the testbot to see if it resolves some of the php 7.1 fails that are currently seen in the testbot results.

Julien Tekrane’s picture

I had also this error in a first install on a server.

Look at in your /etc/php5/fpm/php.ini file and look at what is defined for the "session.save_handler" parameter.
In my case I use "memcached".

Does this library is installed in your server ? (I had this clue by tempting an /update.php )
So run this commands in your server (if your are sudoer) :

  • sudo apt-get install memcached
  • sudo apt-get install php5-memcached

And restart your PHP server & Webserver server.

MustangGB’s picture

Category: Bug report » Support request
Priority: Critical » Normal
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

webservant316’s picture

Ridiculous, why I am getting this error with Drupal 7.69?
I cannot even install a fresh copy of D7 on my server.

Error: Call to undefined function field_attach_load() in DrupalDefaultEntityController->attachLoad() (line 354 of /home/adminl/public_html/domain.learnh2o.com.test/includes/entity.inc).

Sorry, fixed.

My server requires secure cookies and so all access must be on HTTPS, but I forgot that and was trying the install on HTTP. I guess the reason the error persists is maybe there is a 1000 different reason the install can fail at this point.

joseph.olstad’s picture

see the above comment (number 4) by Divya Pandey
#2845175-4: Fatal error: Call to undefined function field_attach_load() in entity.inc on line 354 during installation

I have researched this and related issues and found just drop and recreate the database as utf8_general_ci solve the problem