Welcome Guest, Not a member yet? Register   Sign In
CI Project doesn't work on 2nd machine
#1

[eluser]OldRodKS[/eluser]
I took my project home to work on last night and when I tried running it at home, I got something strange.

It's a simple user login/registration system. On the main page is a link to Register a new account, which links to "localhost/bannor/register/". At work this link works fine, but at home, when I click the link, I get the localhost server configuration page.

In fact any links on any of my pages display the server configuration page. Even if I go to the URL bar in Chrome and try accessing the pages directly that way, I get the same problem.

Both machines are now running the same version of WAMPServer, so they have the same Apache, PHP, etc.

I compared the PHP and Apache INI and .conf files from my two machines and they are identical.

What am I not seeing?
#2

[eluser]TWP Marketing[/eluser]
Are both servers set up as localhost?
#3

[eluser]OldRodKS[/eluser]
Yes. The initial page loads, it's just the links to other pages are messed up, and trying to load the other pages directly displays the server configuration page.
#4

[eluser]TWP Marketing[/eluser]
Check your config.php for the base_url var line 17 or thereabouts. It may be different on the two machines. If the site is configured for the full domain name on one server but not the other, then the base_url will be different. Just guessing here...

Check the hosts file also.
#5

[eluser]OldRodKS[/eluser]
Good call - there was a problem with my hosts file. It's working now. Thanks!
#6

[eluser]OldRodKS[/eluser]
Well, I spoke too soon... it's not working after all (not sure why it worked that one time...)

My main page loads fine (see below), but any other page, whether I click a link to it, or try to load it directly, loads the wamp server configuration page.

For instance I have 'register.php' under c:/wamp/www/bannor/applications/controllers/

Here is the contents of that file:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Register extends CI_Controller {

public function index()
{

}
}

/* End of file register.php */
/* Location: ./application/controllers/register.php */

In my config file, I have base_url set to '' (it doesn't work setting it to 'http://localhost/bannor/' or 'localhost/bannor/' either)

index_page is set to '' in config

and in my routes.php file I have default_controller set to 'home' which is what my base page is called.

Strangely enough, when I just go to /localhost/bannor/ I get the home view like I would expect, but if I explicitly type /localhost/bannor/home/ I get the same wamp configuration page that all the others give me.

And all this only occurs on one machine - the other machine they work fine.

Both machines are running Win7 64bit Ultimate edition. Both are using Google Chrome as the default browser (problem occurs in Firefox too though).

Both machines have identical INI and CONF files, both are running the same version of WAMP, both HOSTS files are identical...

I'm losing my mind here Smile
#7

[eluser]TWP Marketing[/eluser]
Are you using .htaccess to remove index.php from all your URL's?
If so, is .htaccess in the correct directory? Check your localhost location and it should be the same on the production server.

What happens if you include index.php in the URL?

Also I see your controller does not use a constructor. It may not be necessary for your configuration.
Code:
public function __construct()
{
parent::__construct();
  // Your own constructor code
}
#8

[eluser]OldRodKS[/eluser]
Sorry been tied up for a couple days. Finally got back to this.

The problem is definitely my .htaccess file. If I remove it, then the pages load normally, I just need to include 'index.php' in the URL.

Here is my .htaccess file. It's just a stock file except for the rewrite base which I put to the root folder of my site (the URL is http://localhost/bannor/ - did I mess this part up?)

Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /bannor/

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]
    
    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

    ErrorDocument 404 /index.php
</IfModule>

.htaccess is in my root c:/wamp/www/bannor/ directory

*EDIT* Never mind - I figured it out. mod_rewrite was not turned on in my Apache server modules. /faceslap




Theme © iAndrew 2016 - Forum software by © MyBB