drlq92444 2011-03-06 17:56
浏览 48
已采纳

LAMP / CakePHP怪癖 - 在本地工作,而不是在远程服务器上工作。 调试技巧?

DISCLAIMER - I am total PHP noob - looking for some help/tips on how to debug this problem...

I have a PHP/CakePHP based app running on Linux/CentOS and MySQL.

Its also running on my local dev machine (OSX Snow Leopard).

One small part of the app however is behaving inconsistently between the two.

I have copied the DB and the PHP code from the server to my local machine - so pretty sure they are in sink. Note the app was originally developed elsewhere and then deployed to the server.

The different is that there is a master/detail type page - on both sites the master part works fine, but the detail part is only working for my local/OSX version.

I have checked the DB and the detail records seem to be present as expected.

The PHP version is slightly different.

Linux Server:

HP:  Error parsing /usr/local/lib/php.ini on line 803
PHP 5.2.16 (cli) (built: Mar  1 2011 11:48:38) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v3.3.20, Copyright (c) 2002-2010, by ionCube Ltd.

Server version: Apache/2.2.17 (Unix)
Server built:   Mar  1 2011 11:42:56
Cpanel::Easy::Apache v3.2.0 rev5291

OSX Local:

PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Server version: Apache/2.2.15 (Unix)
Server built:   Jul  1 2010 17:16:33

I have tried restart Apache, in case it was a caching issue. I have tried changing master details via mysql command line and those changes are being shown.

Tried turning on display_errors/display_startup_errors - but nothing is being shown.

Wonder if there are any CakePHP debug tips... perhaps should look into that.

My plan is to install the app on another server to see if that works and/or helps identify the difference/issue.

The PHP code that seems to be the issue is this (its in one of the cakePHP controllers):

    $carInsuranceQuoteRequest = $this->CarInsuranceQuoteRequest->find('first', array(
        'conditions' => array(
            'CarInsuranceQuoteRequest.id' => $id,
        ) ,
        'contain' => array(
            'Company' => array(
                'Attachment'
            ),
            'CarInsuranceVehicleType',
            'CarInsuranceVehicleMake',
            'CarInsuranceVehicleModel',
            'CarInsuranceVehicleVersion',
            'CarInsuranceCoverageType',
            'CarInsuranceQuoteResponse' => array(
                'CarInsuranceQuoteSite'
            ),
        ),
    ));

The quote request object is being returned ok on both installs. But the quote response object is always empty on the linux box, even though they seem to be ok in the mysql db. The responses are being displayed fine under OSX.

The PHP error on line 803 is

 ; url_rewriter.tags: (ini file field description not available)
url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset=

Thanks in advance for any tips, Chris

FWIW - my problem was due to the cakePHP models being wrong and so it wasnt able to navigate the relations. I had changed the mysql table. For some reason it got over the issue on my local machine.

  • 写回答

1条回答 默认 最新

  • duanleiming2014 2011-03-06 18:10
    关注

    Chris,

    Try turning on CakePHP debug output in your app. In the file app/config/core.php you should find a line like this setting the CakePHP debug level:

        Configure::write('debug', 0);
    

    Change it to:

        Configure::write('debug', 1);
    

    or a higher value. This should produce some error output and get you going in the right direction in narrowing down the source of your problems.

    Remember to set it back to 0 for a production configuration. The documentation for this is as follows:

    /**
     * CakePHP Debug Level:
     *  * Production Mode:
     *      0: No error messages, errors, or warnings shown. Flash messages redirect.
     *
     * Development Mode:
     *      1: Errors and warnings shown, model caches refreshed, flash messages halted.
     *      2: As in 1, but also with full debug messages and SQL output.
     *      3: As in 2, but also with full controller dump.
     *
     * In production mode, flash messages redirect after a time interval.
     * In development mode, you need to click the flash message to continue.
     */
    

    Also remember to check your Apache error log file for any helpful output.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料