0

I have deployed my site on a VPN server. I am able to access the controller constructor, but when I am trying to call any method like mydomain/controller/method, it is not working. However 'mydomain/controller/index' is also not working.

When I am debugging with php method function_exists('my function name') then also it is coming up false even though that method exist in my controller.

Please help with this problem, and let me know if I have to do any config changes.

Thanks!

16
  • 4
    How is it not working? Do you get any PHP errors? Any output in any way? Any HTTP status codes? Just give us something to work on.... Commented Dec 16, 2011 at 8:26
  • No i have no seen error only blank page. Commented Dec 16, 2011 at 8:28
  • 2
    That probably means that your PHP fails silently because you haven't enabled error reporting. Take a look in your error log on your server, it will probably contain some PHP errors. Or enable error reporting Commented Dec 16, 2011 at 8:32
  • Are you using htaccess to rewrite your URLs? Commented Dec 16, 2011 at 8:32
  • How can i check error in file with php functions is there any? Commented Dec 16, 2011 at 8:34

1 Answer 1

7

You will need to navigate to http://mydomain/index.php/controller/method

... unless you specifically have a .htaccess file in the root where index.php is that eliminates index.php from the URL.

If you have this .htaccess file set correctly you will be able to navigate to http://mydomain/controller/method

here is an example of an .htaccess file for codeigniter that I'm using for debugging.

php_flag display_errors on 
php_value error_reporting 7 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|css|robots\.txt) 
RewriteRule ^(.*)$ /index.php/$1 [L]

copy all of this text to a file called .htaccess and put it where index.php is in the codeigniter root directory.

///////////////// Edit based on more info from OP //////////////////

First test to see if the following works..

Unless you deleted it, CI provides you, by default a welcome controller (/application/controllers/welcome.php) and a welcome view thats being called by the controller (/application/views/welcome_message.php).

See if these files are there and if they aren't get them from the zip file in the codeigniter framework and put it in these directories.

navigate to the config folder and open routes.php (/application/config/routes.php) and under reserved routes put in $route['default_controller'] = "welcome"; if it's not already there.

In addition make sure you have the Config changed to reflect the fact that you are using the .htaccess file.

the property should be set as follows in config.php $config['index_page'] = '';

Note that if you are not using .htaccess this would be set to $config['index_page'] = 'index.php';

These instructions are in an effort to get you to see something on the page. You would change the default controller to your controller (not welcome) when you get going with the above.

Sign up to request clarification or add additional context in comments.

4 Comments

Are you even able to load the sample page without any modifications? Also, look into getting the Firebug/FirePHP combo for firefox.
yes i have create a test.php with class in root of CodeIgniter dir.It is working fine.but not the controller....:(
OK, ok we're getting closer to the problem. You said you created a test.php in the CI root? What for?? You wouldn't normally use this file in a CI build being in the CI root. Anyways, that's not what i was getting at. In a CI build you get a welcome controller with a view are you seeing this welcome message?
Did you try everything I suggested? If yeah, there is something more esoteric going on that we'll need more information on to help. The only other thing I can suggest at this point is to download the whole framework again, put it into a new location on the server. Navigate to the location + /index.php/welcome.php and see if that works. If it doesn't there could be something wrong with the server/ports etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.