【问题标题】:Call to a member function find() on a non-object error in unix only仅在 unix 中对非对象错误调用成员函数 find()
【发布时间】:2012-04-20 23:45:00
【问题描述】:

我正在使用 cakephp 2.0 和 Wamp,一切都很好。但是,生产服务器是 unix Ubuntu。两台计算机访问相同的 mysql 数据。 我有这些关系:

Model setup.php
var $belongsTo = array('Client', 'User');

Model client.php
var $hasMany = array('Setup');

Model user.php
var $hasMany = array('Setup');

在 localhost WAMP 中一切正常,但生产服务器是 unix ubunto,我将整个目录复制到其中。 chmod 777 一切后,该应用程序运行正常,除了这些错误:

注意(8):未定义索引:客户端[APP/View/Setups/index.ctp,第38行]

index.php line 38
<td><?php echo $this->Html->link($setup['Client']['name'], array('controller' =>
'clients', 'action' => 'view', $setup['Setup']['client_id'])); ?>&nbsp;</td>

注意(8):未定义索引:用户[APP/View/Setups/view.ctp,第66行]

view.php    line 66
<?php echo $this->Html->link($setup['User']['name'], array('controller' => 'users',
'action' => 'view', $setup['User']['id'])); ?>`

另外,http://mailsender.asc/setups/add

致命错误:在
中的非对象上调用成员函数 find() /disk/www/mailsender/app/Controller/SetupsController.php 在第 69 行

SetupsController.php (line 69 is the "find" on add function)
public function add() {
// The relations belongs, has many etc.
$users = $this->Setup->User->find('list');

(IT 建议 /cake upgrade all 进行修复,它似乎修复了上述问题但破坏了其他事情,例如注销和登录)。

有人可以帮忙吗?

我还想知道在将整个应用程序从 Windows 本地计算机移动到 unix ubuntu 时是否应该采取任何步骤。

提前谢谢你! 最好的问候。

卡洛斯 来自墨西哥蒂华纳。

unix 版本:

Linux 基因 3.0.0-12-generic-pae #20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 i686 i686 i386 GNU/Linux

php 版本: 本地主机:版本 5.3.0 genesi(生产服务器):版本 5.3.6-13ubuntu3.6

【问题讨论】:

    标签: cakephp


    【解决方案1】:

    users.php 应该是user.php(单数)

    【讨论】:

    • user.php 好的。模型 es user.php。这只是我的问题中的一个错字。 --- ! ----
    猜你喜欢
    • 1970-01-01
    • 2017-04-30
    • 1970-01-01
    • 1970-01-01
    • 2013-01-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多