Welcome Guest, Not a member yet? Register   Sign In
CI on localhost - blank index, unfound controller
#1

[eluser]mabright[/eluser]
OK, after reading a few threads and post, I still have not resolved my issue.

I have successfully used CI in the past on hosted servers, this time I am trying to use it on my local machine but I get a blank page, etc.

I have apache 2.2 and PHP 5 installed. Apache workes and I verified PHP is working.

For the sake of this thread, let's say my website is called wackamole.

If I go to http://localhost/wackamole I see the following.

Index of /wackamole

Parent Directory
.buildpath
.project
.settings/
application/
css/
img/
index.php
license.txt
scripts/
system/
user_guide/


If I click index.php, I get a blank screen. I created a controller called main, if I go to localhost/wackamole/main, I get "The requested URL /wackamole/main was not found on this server.".

My settings are :

Config.php
$config['base_url'] = 'http://localhost/wackamole/';
$config['index_page'] = '';

Routes.php
$route['default_controller'] = "main";

My .htaccess is like below.
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ safememoirs/index.php/$1 [QSA,L]
</IfModule>

Looks like I get the below error in my apache error log.
[Wed Mar 13 12:07:26 2013] [error] [client 127.0.0.1] client denied by server configuration: C:/webdev/htdocs/wackamole/.htaccess
#2

[eluser]InsiteFX[/eluser]
Try this:
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /http://localhost/wackamole

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://localhost/wackamole/index.php/$1 [L,QSA]
</IfModule>
#3

[eluser]Harold Villacorte[/eluser]
Maybe try adding this to .htaccess:
Code:
DirectoryIndex index.php
And make sure "main" controller has an index method that does something.
#4

[eluser]InsiteFX[/eluser]
He may also need to add this to his .htaccess file also.
Code:
Options +FollowSymLinks
#5

[eluser]mabright[/eluser]
I update .htaccess, I think the update solved the apache issue, I no longer see the access error in the apache log. However, still blank. I go to wackamole/index.php (blank), wackamole/index.php/main (blank), wackamole/main ("The requested URL /wackamole/main was not found on this server.").

Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /http://localhost/wackamole

DirectoryIndex index.php
Options +FollowSymLinks

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://localhost/wackamole/index.php/$1 [L,QSA]
</IfModule>

main.php
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Main extends CI_Controller {

public function index()
{
  $this->load->view('tmpl/global_head_view');
  $this->load->view('main_view');
  $this->load->view('tmpl/global_foot_view');
}
}
#6

[eluser]Harold Villacorte[/eluser]
Does it work without .htaccess?
#7

[eluser]mabright[/eluser]
[quote author="Harold Villacorte" date="1363201171"]Does it work without .htaccess?[/quote]

No, not really. I made a change to the apache httpd file (see below) and now the site is all whacky. I just want to start working on my new code and I am losing my mind trying to setup the environment.

Now when I go to localhost/wackamole I no longer see a directory list, I guess this is a good thing. When I go to localhost/main, the URL switches to localhost/wackamole/index.php/main but still the page is blank. There is no log in the application log folder.

Can someone verify my httpd file settings (see attached) and my .htaccess (below)?

Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /http://localhost/wackamole

DirectoryIndex index.php
Options +FollowSymLinks

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://localhost/wackamole/index.php/$1 [L,QSA]
</IfModule>

Code:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/webdev/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.  
#
<Directory />
  Options FollowSymLinks
  Order allow,deny
  Allow from all
</Directory>

<Directory "C:/webdev/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
  Order allow,deny
  Allow from all

</Directory>
#8

[eluser]Harold Villacorte[/eluser]
If CI is not working out of the box then it's probably a server or php config issue. If it were me I would not waste any time trying to configure apache on windows, I would just start with a fresh xampp install which should not need any configuration.
#9

[eluser]Aken[/eluser]
How has no one mentioned error reporting being disabled yet? It's by far the most common reason behind a blank page...
#10

[eluser]mabright[/eluser]
[quote author="Aken" date="1363206421"]How has no one mentioned error reporting being disabled yet? It's by far the most common reason behind a blank page...[/quote]

$config['log_threshold'] = 1;

Is there another setting I need to maintain for logging?




Theme © iAndrew 2016 - Forum software by © MyBB