Welcome Guest, Not a member yet? Register   Sign In
Views not finding Controllers on lighttpd

I built my site locally running on apache, it works fine.
When transferring to my ubuntu vps running lighttpd, my views do not seem to be loading the controllers or views.
I get a very short snippet of my view printed when i go to http://my-app-address/index.php/myview.
When I view this locally, a full webpage (with header, footer etc.) is shown.

I can select and view from my database fine if i do this all in the view, however, it is clearly not finding the controller or model.

I have a suspicion that this is connected to my uri_protocol line in my config.php though I have tried every variation without any success.

I am not using any mod_rewrite stuff yet.

Thanks in advance

I'm not sure what you mean by it's not loading the controllers or views? Or what you mean by not finding the controller or model?

If you're running it with php-fastcgi, you may have to set your config like this:

$config['uri_protocol'] = "REQUEST_URI";

and be sure to pass on all the appropriate variables

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

fastcgi_param  REDIRECT_STATUS    200;

Thanks for the response - I'll provide a link -


In this view if I write the code to select from my db and echo in this file I can show contents of the db easily, however when the SELECT is in the controller or model, I get the result shown. I am not using php-fastcgi. Thanks

It looks like you might be using short tags when they aren't supported by your server. Also, you're view shouldn't be loading any helpers, that should all be done in the controller IMHO.

CodeIgniter can be set to parse short tags on servers that don't support it, but it comes at the cost of a little more overhead.

Quote:It looks like you might be using short tags when they aren’t supported by your server.

By short tags I take it you are meaning just replacing <? with <?php right?

Quote: Also, you’re view shouldn’t be loading any helpers, that should all be done in the controller IMHO

Yeah that makes sense, I'll let you know how i got on with that after work.


That's correct. Short tags usually come in the following formats:
<? $this->load->view('some_view') ?>

# or to echo data

<?= $some_value ?>

Here's a link to the CodeIgniter PHP Style Guide if you're interested - http://ellislab.com/codeigniter/user-gui...guide.html. Adhering to it can save you a lot of potential headaches. Smile

Thank you - It was the short tags I've gone through and changed them to proper start tags now and all is well, really appreciate all the help and rapid response

I'm glad you got it sorted. Smile

Theme © iAndrew 2016 - Forum software by © MyBB