ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Debugging Problem with Aptana Studio 2.0 in Code Igniter

December 17, 2009 7:33pm

Subscribe [3]
  • #1 / Dec 17, 2009 7:33pm

    Rey Philip Regis

    92 posts

    Hi guys,

      I’ve installed Aptana Studio 2.0 it runs good in the preview. But I have problem with the debugging feature of Aptana. I’m having this error

    X-Powered-By: PHP/5.2.10 ZendServer
    Set-Cookie: ZendDebuggerCookie=127.0.0.1:10000:0||00C|77742D65|1000; path=/
    Set-Cookie: PHPSESSID=a9ed93765048c81dd34ec1ca7b6e4590; path=/
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Content-type: text/html

    Fatal error:  Class ‘Controller’ not found in C:\wamp\www\ci\system\application\controllers\test.php on line 4


    This is my code:

    <?php
    class Test extends Controller
    {
        public function __construct()
        {
            parent::Controller();
    
            $this->load->database();
        }
    
        public function index()
        {
            echo 'test';
        }
    }
    ?>

    It say’s there that the class Controller is not found. How come it has an error in the debugging feature. But it runs when I preview it in both IE and Firefox in Aptana’s built in server.

    Any ideas?

    Good day…...

    Philip

  • #2 / Dec 17, 2009 8:41pm

    BrianDHall

    760 posts

    In most debuggers you have to set it to run index.php by default, then you can set breakpoints inside a controller and the debugger will stop when it gets there - but it has to start at index.php, not in the controller file itself.

    This is how netbeans and PHPed work, so I presume Aptana is similar.

  • #3 / Dec 18, 2009 9:49am

    Rey Philip Regis

    92 posts

    Hi Brian,

      Can you tell me how to do it CodeIgniter? Where will I create the index.php file? The only index.php file I found is with the same heirarchy with the system folder. Can you give me some instructions on how to make the index.php file, where to put it and sample code to run the test controller I made. Thanks in advance.

    <?php
    class Test extends Controller
    {
        public function __construct()
        {
            parent::Controller();
    
            $this->load->database();
        }
    
        public function index()
        {
            echo 'test';
        }
    }
    ?>

    I want to run the index function in the test controller. Good day.

    Philip

  • #4 / Dec 18, 2009 5:01pm

    SpooF

    170 posts

    All pages run through the index.php file in the root of the codeigniter package. In aptana your running your controller php file. You need to run the index.php file instead.

  • #5 / Dec 18, 2009 10:46pm

    BrianDHall

    760 posts

    Indeed, there is only one index.php file for codeigniter - it is often referred to as the “front controller” or entryway to the framework. Most frameworks use the same concept.

    So what happens is no matter what page you request, the call is made to index.php. Index.php includes various files and starts up codeigniter itself, eventually resulting in the superobject that your Controllers will refer to as $this. So if you start execution in the controller file, indeed there will be no Controller class, and no class that the controller depends upon, etc.

    In Netbeans when setting up a project it asks about if it is a local site or a remote site, and has an option below the url of the project to allow a default file to be specified when running/debugging the project. Here I just type in “index.php” and that’s it. When I click Debug Project my browser pops open with a request to mysite.localhost/index.php?NETBEANSSESSIONINFOetcetc

    I set a breakpoint in my controller or model of choice, then when I browse to a page that would execute that code in my browser execution of the page is stopped, and over in Netbeans it awaits my further instructions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases