1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading ... Loading ...

Yii is a great framework. It gives excellent built-in functionality, but, from my experience, is quite sensitive to the server configuration. Mostly because it relies on the newest technologies.

So here is a list of things to check when you experience strange things (blank screen without any messages is the worst one that may happen):

  • Check PHP version. Yii needs 5.1 at least. When using some specific PDO or other features in your application, ensure they’re available in the server’s PHP installation.
  • Check MySQL version. Should be at least 5. If it differs from development one (e.g. server has 5.0.21 and you have 5.0.51), then pay attention to the CDbConnection::emulatePrepare. Actually if you’re using MySQL, you’d better turn it on because MySQL doesn’t cache prepared statements and has buggy support for some types of qeries (e.g. SHOW)
  • If you’re using automated timestamps insertion like described in Yii Cookbook, you may encounter problems, when using different PDO or MySQL version. If you see your queries fail, try using
    1. date(‘Y-m-d H:i:s’)

    instead of

    1. new CDbCommand(‘NOW()’)
  • When you can’t see any output, configure logging. If log is emply also, try die(‘message’) in all possible places. Starting from the entry script, continuing to your controller’s action. In some cases PHP crash is possible, which leads to immediate application termination, which makes both Yii logging and PHP’s echo ineffective and only die() workds fine
  • When using different PHP version, PDO versin may be different also. If you have application crashes when using bindParam(), try using bindValue() instead. This helps sometimes
  • Don’t forget to switch off YII_DEBUG in the index.php (entry script). However, if you encounter any problems, switch it back to help debugging

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Share this post with a friend Share this post with a friend

5 Comments

  1. jz says:

    s/debgging/debug/ #IMHO

  2. James from FaceySpacey.com says:

    Great Yii starter post bro!

  3. snnwolf says:

    Remember setup CLogEmailRouter for error application reporting

  4. Rubén says:

    Hi, your tip date save me, thanks.

  5. Online advertising says:

    …A Friend recommended your blog…

    [...]The whole look of your web site is fantastic, let well as the content material![...]…

Leave a Reply