[ASK] Can't display captcha image

hi, I am newbie in the Yii framework. now I am having trouble.

I make registration form but can’t display captcha image.

Biodata.php model code


class Biodata extends CActiveRecord


        public $verifyCode;


        public static function model($className=__CLASS__)


                return parent::model($className);



         * @return array validation rules for model attributes.


        public function rules()


                // NOTE: you should only define rules for those attributes that

                // will receive user inputs.

                return array(


                        array('idprogram_studi, tahun_lulus', 'numerical', 'integerOnly'=>true),

                        array('tgl_lahir', 'safe'),


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

                           // MUST BE AFTER ABOVE LINE:

                //      array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),



code on view add.php

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(



)); ?>

        <p class="note">Fields with <span class="required">*</span> are required.</p>

        <?php echo $form->errorSummary($model); ?>


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

        <div class="row">

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


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

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


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

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


        <?php endif; ?>



class BiodataController extends Controller



         * @var string the default layout for the views. Defaults to '//layouts/column2', meaning

         * using two-column layout. See 'protected/views/layouts/column2.php'.


        public $layout='//layouts/column2';


         * @return array action filters


        public function actions()


                return array(

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





                        // page action renders "static" pages stored under 'protected/views/site/pages'

                        // They can be accessed via: index.php?r=site/page&view=FileName






I’ve tried copying the captcha that’s in contact form, but still not running. if the captcha is not able to walk in CActiveForm?

Note: Try not to post the same question multiple times (4)…

Just to clarify… when you make a new Yii webapp… do you see the captcha in the contact form?

sorry my internet connection is bad.

I’ve tried that in the contact form but it still does not work

For the duplicate posts - even if you get an error when submiting a form - the form could be submited… so first check if it has been submited, before re-submiting… so to not post it twice…

For the captcha - seems you don’t have FreeType installed…

If you have Yii 1.1.5 - check the requirements it should tell you if FreeType is missing

I do not know if duplicate posts when I submit emerge mysql error.

where I can check the FreeType is installed or not?

If you submit a post and get an error… do not resubmit… first try to open the same page in a new browser window so to see if your post has been submited (most of the time it is)… only if it is not submited do re-submit…

I already told you to check the Yii requirements…


I’ve checked all of the requirements. all requirements are met

Do you use Yii 1.1.5?.. The last line in the requirements table should read - "GD extension with FreeType support"

If the new Yii webapp is called yiitest for example, try to open this in the browser


It should display only the picture…