CakePHP find not returning correctly - missing mod

2019-02-28 12:38发布

After performing a find on a model I would expect the result to be of the format

Array
(
    [0] => Array
        (
            [ModelName] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )    
        )
)

However, what I appear to be getting is

Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [id] => 83
                    [field1] => value1
                    [field2] => value2
                    [field3] => value3
                )

        )
)

Note the missing model name.

I've only been getting this problem since migrating across to what appears to be a very poorly configured VPS that I now have full control over.

My problem is, I can't think of anything that would cause this problem. Any ideas greatly appreciated.

1条回答
迷人小祖宗
2楼-- · 2019-02-28 13:16

Turns out to be very similar to this.

Again the problem was with an outdated pdo_mysql version.

This can be checked by running

strings -f pdo_mysql.so | grep ': table'

If there are no results then pdo_mysql is out of date most likely due to an installation such as

pecl install pdo_mysql

My fix was an easy one

yum install php53-mysql

I hope that this helps someone.

查看更多
登录 后发表回答