Yii Captcha Image Was Not Displayed On My Web Hosting

Hi guys,I have a Yii Web project in localhost. The site works perfectly in localhost but in my web hosting the yii captcha image was not displayed.

My SiteController :


public function accessRules()

    {

        return array(

            array('allow',  // allow all users to perform 'index' and 'view' actions

                // need to allow captcha in order to view it.

                'actions'=>array('create','view','index','captcha'),

                'users'=>array('*'),

            ),

            );

    }

public function actions(){

        return array(

        // captcha action renders the CAPTCHA image displayed on the contact page

            'captcha'=>array(

            'class'=>'CCaptchaAction',

            'backColor'=>0xFFFFFF,

            ),

}

My ContactForm Model:


public $verifyCode;

public function rules()

    {

        return array(

            // name, email, subject and body are required

            array('name, email, subject, body', 'required'),

            // email has to be a valid email address

            array('email', 'email'),

            // verifyCode needs to be entered correctly

            array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd')),

            );

    }

My contact view:


<?php if(extension_loaded('gd')): ?>

        <div class="span4">

            <?php echo $form->labelEx($model,'verifyCode'); ?>

            <?php echo $form->textField($model,'verifyCode'); ?>

            <div>

                <?php $this->widget('CCaptcha'); ?>

            </div>

            <div class="hint">Please enter the letters as they are shown in the image above.

            <br/>Letters are not case-sensitive.</div>

        </div>

    <?php endif; ?>

My hosting: Library GD


GD Support  enabled

GD Version  bundled (2.1.0 compatible)

FreeType Support    enabled

FreeType Linkage    with freetype

FreeType Version    2.4.2

T1Lib Support   enabled

GIF Read Support    enabled

GIF Create Support  enabled

JPEG Support    enabled

libJPEG Version 6b

PNG Support enabled

libPNG Version  1.2.44

WBMP Support    enabled

XPM Support enabled

libXpm Version  30411

XBM Support enabled

Directive   Local Value Master Value

gd.jpeg_ignore_warning  0   0

My localhost server:


gd

GD Support  enabled

GD Version  bundled (2.0.34 compatible)

FreeType Support    enabled

FreeType Linkage    with freetype

FreeType Version    2.4.11

T1Lib Support   enabled

GIF Read Support    enabled

GIF Create Support  enabled

JPEG Support    enabled

libJPEG Version 9

PNG Support enabled

libPNG Version  1.5.14

WBMP Support    enabled

XPM Support enabled

libXpm Version  30411

XBM Support enabled


Directive   Local Value Master Value

gd.jpeg_ignore_warning  0   0

My hosting dindt have imagemagick library installed.

My .php files are in UTF8 wihout BLOM Do not understand why it does not work :(

I need a litle help for fix this problem.

Not all. Somewhere you have a file with UTF-8 BOM - try to download the image and check the file source in a hex editor.

Result hex editor

Yes. The first 3 char is EF BB BF = UTF-8 BOM.

Does the image should be in another format? or this doesnt matter?

I fix the problem. The config/main.php was in UTF8 ( The file should be in UTF-8 BOM. )