Thursday, September 9, 2010

Setup and debug an Yii app in Netbeans IDE

After using Eclipse for a while I switched to Netbeans IDE for Yii development. It seems faster and easier to setup. Following is my experience of setting up the development environment.

Create a project stub using the following command -
>> yii-1.1.3.r2247\framework\yiic webapp mytestapp

Open Netbeans IDE and proceed with the following steps -
1. Click on File-> New Project
    This will open up a dialog box. Select "PHP" under "Categories" and under "Projects" select "PHP Applications with Existing Sources".


    Click Next.
2. In the "Sources Folder", input the path of "mytestapp" folder on your machine.
    Assign a project name. "mytestapp" for my case.
    Select a PHP version.
    Click Next
3. The options in this form should be set up automatically like below.
   

    Click Finish
   
    This should set up your Yii project in Netbeans IDE.
   
4. Go to "Debug" menu on the top bar on Netbeans IDE. Select "Debug Project(mytestapp)" and you should be able to debug your project.


5. "Continue(F5)" option in Debug can be used to resume a stopped debug session.
   

9 comments:

Anonymous said...

Thanks for that visual tutorial, I had a very good feel of debugging with Yii app in NetBeans just today, http://twitter.com/dantejarabelo/status/26256924472

Orijit Banerjee said...
This comment has been removed by the author.
Orijit Banerjee said...

awesome blog this. plain and simple. I was thinking of something on similar lines but this is good enough.

I was planning to change my PHP IDE and start using either Netbeans or Eclipse. Now netbeans work like a charm (with code-completion :)

Something on XDebug in Netbeans coming from you?

Harpreet said...

@Orijit - Perhaps sometime, but not sure when :)

Anonymous said...

I use and suggest Codelobster PHP Edition. It has Yii plug-in for installation, autocomplete, help and etc.

Anonymous said...

Codelobster PHP Edition

xuongrong said...

Sorry my english....
i try to create new project with yii but i had problem.when i wrote on cmd:
"c:xampp\htdocs\ext4yii-1.1\yii\framework\yiic weapp demo"
appear message: "'php.exe'is not recognized as an internal or external command, operable program or batch file". i could not to fix it.
Please help me. Thanks

Angela said...

wonderful tutorial.. Installation complete after my 3 days of trial.. You are a life saver!! :)

Anonymous said...

@xuongrong configure the path in Environment Path settings to your PHP executable path.

Just go to my computer -> rightclick on it -> properties, go to advanced settings (Win7) and then look for the "PATH". DOuble click on it then at the end, append the following:

;C:/xampp/php/

nexet time you wrtie a php cmmand, it will check that path and run php.exe which is in C:/xampp/php/