Cakephp 2.3.8无法在linux服务器上运行,但在我的macbookpro上运行oK

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.

Your model file is the wrong case

From the book:

CakePHP will dynamically create a model object for you if it cannot find a corresponding file in /app/Model. This also means that if your model file isn’t named correctly (i.e. ingredient.php or Ingredients.php) CakePHP will use an instance of AppModel rather than your missing (from CakePHP’s perspective) model file.

It should be named Nailcolor.php - from the question I guess it's called nailcolor.php, Mac OSX is a case insensitive (by default) and hence can find the file whereas linux (which is case sensitive) cannot. There's more about CakePHP's file naming conventions in the book.

You can verify that this is the problem with the following code:

if (get_class($this->Nailcolor) === 'AppModel') {
    die("app/Model/Nailcolor.php file not found");
}

how can I set the php.ini or cakephp settings

There is no setting to to modify this behavior as it's inherited from the operating system (or more accurately from the format of the disk where the files are stored).

Seems, it's a typo

use not

class nailcolor extends AppModel {

but

class Nailcolor extends AppModel {

so, use Capital N