I develop some website on my MacBook Pro.use Cakephp 2.3.8. it work so good. but,I up the code to the linux server(on hostmonster.com). it had some bug.
environment for Mac: osx 10.8.4 PHP 5.3.15 with Suhosin-Patch (cli)
environment for Server: linux 2.6.32 PHP 5.3.26 (cgi-fcgi)
and the code is the same.
1、Error: Call to a member function find() on a non-object
controller:
$kinds = $this->Nailcolor->Kind->find('list'); //it not work on server,but on my mac is ok.
model:
class nailcolor extends AppModel {
public $validate = array( ... )
public $belongsTo = array(
'Kind' => array(
'className' => 'Kind',
'foreignKey' => 'kind_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
2、
debug($this->Nailcolor->find('first', $options));
result on mac
array(
'Nailcolor' => array(
'id' => '1',
'kind_id' => '2',
'name' => 'aaaa',
'color' => 'aaaaa',
'naila' => 'aaaa',
'nailb' => 'aaaaa',
'nailc' => 'ccc',
'naild' => 'ccc',
'naile' => 'ccc',
'nailm' => 'aqaa',
'description' => '',
'created' => '2013-07-16 15:16:56',
'modified' => '2013-07-16 15:16:56'
),
'Kind' => array( /*if run on server,not had "kind". */
'id' => '2',
'name' => 'kkkk',
'description' => '',
'created' => '2013-07-16 15:15:44',
'modified' => '2013-07-16 15:15:44'
)
)
result on server:
array(
'Nailcolor' => array(
'id' => '3',
'kind_id' => '4',
'name' => 'aaaa',
'color' => '0203',
'naila' => 'aaa',
'nailb' => 'aaa',
'nailc' => 'aaaaa',
'naild' => 'aaaaaaa',
'naile' => 'aaaaaa',
'nailm' => 'aaaaaaaaa',
'description' => '',
'created' => '2013-07-18 02:51:29',
'modified' => '2013-07-18 02:51:29'
)
)
so on the view.ctp on the server is don't work.
<?php echo $this->Html->link($nailcolor['Kind']['name'], array('controller' => 'kinds', 'action' => 'view', $nailcolor['Kind']['id'])); ?>
why????how can I set the php.ini or cakephp settings???? I want the same result on my mac and on my server.
the code on the upside is generate by "cake bake" on my mac. and I cannot run the "cake bake" on the server.