Welcome Guest, Not a member yet? Register   Sign In
Browser displays View code?!
#1

[eluser]dhall[/eluser]
I recently got a new computer and thought I set up everything correctly for localhost.
Well when I got to view my website through my local host I get the actual view code, not the html output.
Everything worked great on my old machine.
I have MySQL and Apache both running.
What could I be missing?

Sorry... I am still kinda new to all this.
#2

[eluser]Aken[/eluser]
Check your Apache config, make sure the line for the PHP module is uncommented.
#3

[eluser]PhilTem[/eluser]
You get just the code of your view files? Or also of the controller etc? If it's the latter, try Aken's solution, if it's the first, then you might not have output buffering enabled on your new server.
#4

[eluser]CroNiX[/eluser]
A possibility is you are using php short tags in places in your view but it's not enabled in the php.ini. If so, there is also a setting at the bottom of the config file to convert short tags to full tags, so I'd try enabling that and see if it fixes it.

In addition to making sure php is enabled as Aken suggested, you might check to see that apache is setup to read .php files with the AddType handler, and whether the DirectoryIndex contains an entry to read "index.php" in addition to "index.html". Just enabling mod_php doesn't tell apache how to read php files.
#5

[eluser]dhall[/eluser]
Okay so I decided to start from scratch with a clean CI template.
This loaded just fine.
I then created my own Controller and View with a link in the view to take me to a different Controller.
Every time I click on the link it gives me the "Object not found!" message.

My home page View (this loads just fine):
Code:
<h1>hello worlds?!</h1>

&lt;?php
echo anchor('workout','Workouts');
?&gt;

My Controller I am trying to get to through the link (this gives me the error):
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Workout extends CI_Controller {

public function index()
{
  $this->load->view('workout/new');
}
}

Sorry for this extremely basic question... I am completely stuck!




Theme © iAndrew 2016 - Forum software by © MyBB