Welcome Guest, Not a member yet? Register   Sign In
Problems with PHP5.
#1

[eluser]hrundel[/eluser]
Hi, all!
For become familiar with CI, I used PHP4 version and all worked great. But when I switched to PHP5 CI not worked. Even empty project with echo "test", in main controller not showed the string "test".
And problems not in php5 settings, since other my projects (not based on CI) worked perfectly on php5.
I'm used such code (as it described in documentation)
Code:
class Main extends Controller {
    function __construct()
    {
        parent::Controller();
    }
    function index()
    {
        echo "test";
    }
}
result is empty page in browser. I'm also looked at apache logs, and there no errors (all requests return 200 code) and in logs of CI no any errors.
What I do not such as needed?
#2

[eluser]gungbao[/eluser]
please try not to name neither your Controller-Class "Main" nor your controller-File "main".
Try

Code:
class Main_Controller extends Controller {
    function __construct()
    {
        parent::Controller();
    }
    function index()
    {
        echo "test";
    }
}


Save it as "main_controller.php"

and call index.php/main_controller

This works for me.
#3

[eluser]Dr.Dan[/eluser]
Try to use like this:

class Main_Controller extends Controller {
function Main_Controller()
{
parent::Controller();
}
function index()
{
echo "test";
}
}

That is, use constructor function as the same name of the class instead of _construct().
#4

[eluser]hrundel[/eluser]
Don't know why but not worked, I'm tryed both gungbao and Ani variants and both not worked.
It seems the problem only in displaing from controllers information.
If I do some errors purposely (for example in routes.php I place not existed 'default_controller') when errors are showed and also showed 404 errors when I type not existed path in browser.
#5

[eluser]marcoss[/eluser]
[quote author="hrundel" date="1182877069"]Don't know why but not worked, I'm tryed both gungbao and Ani variants and both not worked.
It seems the problem only in displaing from controllers information.
If I do some errors purposely (for example in routes.php I place not existed 'default_controller') when errors are showed and also showed 404 errors when I type not existed path in browser.[/quote]

A controller is not supposed to be used to actually output data, try loading a view and see what happens.
#6

[eluser]Flayra[/eluser]
If you put in an clean CI installation and open it on the server, what happens? Try gradually changing settings , then changing controllers, etc.

Make sure you've set the default path and such in the config.php, but try leaving everything else as-is (meaning it starts on the default welcome-controller).




Theme © iAndrew 2016 - Forum software by © MyBB