Setup Codeigniter Local Testing Environment

by 18 replies
22
Can anyone help me with this issue?

I downloaded my database, and files of my webapp to my localhost. It is a codeigniter application and runs fine online. I got WAMP, and it runs fine. I changed everything in database.php and config.php to the right values, and when I try to load it locally on localhost it hangs at "waiting for localhost."

Ive searched and searched around and cannot find a fix for this. If anyone can help me get this running I'd be grateful!
#programming #codeigniter #environment #local #setup
  • I run WAMP some for testing of PHP scripts but I haven't done it much since I started turning old computers into Ubuntu LAMP servers. I've also used CodeIgniter and moved it from one host to another.

    I don't remember seeing this issue with CodeIgniter when moving from 1 host to another. (There were issues, generally path issues, that I had to deal with but not this one.) So I would guess this is a WAMP not on or CodeIgniter config path not right issue.

    You may have already tried this but just in case...

    The "waiting on localhost" error makes me think you haven't turned the WAMP server on. WAMP has, for the most part, just worked for me so I'm not great at troubleshooting it. When you get the "waiting on localhost" error, have you tried to go to other PHP based pages to see if the server is working properly (right then, not an hour earlier or the day before...)? I would create a phpinfo.php file that calls phpinfo to display information about your PHP install. Then I would use it as my test page to make sure that the WAMP server and its PHP are working properly. Then immediately after that is successful I would try the CodeIgniter page again.

    If phpinfo comes up fine then it is clearly a CodeIgniter issue - probably some path in the config files that was missed or some default value you never had to change before that is different because I believe WAMP will have a different base directory structure - i.e. c:\wamp\www instead of /var/www - than a Linux server.

    If you still have issues I would attempt to isolate which block of your code/which line of your code is causing the issues. I'm assuming you get this error at the index.php page from CodeIgniter, if so, isolating the code shouldn't take too long. I would hazard a guess that something in the CodeIgniter config is still wrong. Once you isolate the line of code that is causing problems it will likely be a CodeIgniter built in function that you can search for help on in the CodeIgniter website. The site will usually provide you a solution once you can search for the error and a function name.

    Hope this helps.
    • [1] reply
    • I've turned everything on. I think its because the application uses URL rewriting.. something about that isnt letting me load the index page. I will check my logs and see what is going on.
  • Seems I had to set $config['uri_protocol'] = "REQUEST_URI";

    it was on auto. Now it gives me:

    "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
    • [1] reply
    • I can't remember the WAMP defaults and this may sound stupid but is mod_rewrite on?
      • [1] reply
  • If your on windows vista or 7 your need to first turn off IIS 7
  • Let's step back here and get to some point that works.

    Get a fresh install of CI from the codeigniter site and plonk it into your
    c:\wamp\www folder.

    Typing in localhost should result in you being greeted by the welcome page.

    If that works, put your CI version of your website back on.

    Now a real website uses paths like /home/mywebsite/public_html

    As spradlig suggested , sounds like a path issue.
    If you've got your DB downloaded in a .sql and the code for the site, do a search for anything to do with where the site was hosted...

    ie if it was on say www.mysite.com look for mysite and things like /home/mysite to see if there are any hard coded paths you need to change.
    Same thing in the DB and the .htaccess file.

    Let us all know how that goes.

    Cheers
    Tim
  • Cleared that error in .htaccess with adding a slash to

    RewriteRule ^(.*)/$ index.php$1 [L]

    NOW /home/ is not found. Some controller... ugh

    /home was not found on this server.
    • [1] reply
    • How about trying this...
      RewriteRule ^(.*)$ /index.php/$1 [L]

      There is a wee difference to what you had.
      • [1] reply
  • @Tim

    Nothing happens when I do that.

    I think Im just going to use a old domain and use my webserver for testing. The problem has to be that my server is Linux and running a 1.0 version of Codeigniter and I cannot replicate that enviornment locally at all. Oh well. I cant waste anymore time on this, got to get v2.0 of my site done!

    EDIT

    Got the test server up and running, and now it wont let me log in. This is great! Going on 3 weeks with no production. I f*&^% hate codeigniter and the stupid ass team who programmed in this s%^ty language. I told them PHP, not a s%^tty framework.

    Just terrible. F^&*ing terrible.
    • [1] reply
    • Great to hear you've got it running!

      I wouldn't go blaming CodeIgniter as such for your woes. You can write a mess in plain PHP just as well.

      Are you running WAMP? There isn't anything that special in CI that would make a difference if its running happily on a Linux Server.

      Regarding the Login, you can dive into your local DB and check out the table with your username and password. If the password is encrypted, you can find the code that does the login and check if its MD5 or what not. Then you can create your own Password using the same encryption method in a PHP script you'll write.. Then update the Database...

      Your Plan B to install it on another website is an option but you may have the same issues, but it's definitely worth a shot.

      If you do get it up on another website and it has a password retrieval option, then use that. Grab the code it generates in its DB and modify your local DB.

      It would really be a lot quicker to have your local version of the script running if you are doing changes.

      We could have had this nutted out in an hour, but seems you are reluctant for any help outside of here, and that's fair as you don't know me from a bar of soap! The offer still stands though.

      Cheers
      Tim
      • [1] reply
  • When you have WampServer installed (the latest) you can left click on the tray icon.
    A menu pops up, Services > Apache > Apache Modules > scroll down the list toe Rewrite_module and click it. The server should reboot automatically, if not click restart all services.
    Then check to be sure that the rewrite module has a check by it.

    CodeIgniter has a setting for URL, usually in the application/config/config.php
    config['base_url'] =

    This is depending on how the app was setup, but generally pretty standard in CI.

Next Topics on Trending Feed

  • 22

    Can anyone help me with this issue? I downloaded my database, and files of my webapp to my localhost. It is a codeigniter application and runs fine online. I got WAMP, and it runs fine. I changed everything in database.php and config.php to the right values, and when I try to load it locally on localhost it hangs at "waiting for localhost."