ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Basic Codeigniter setup on XAMPP isn't working

December 02, 2012 9:49pm

Subscribe [4]
  • #1 / Dec 02, 2012 9:49pm

    steve_web

    2 posts

    I installed the latest version of Codeigniter on my XAMPP install on Windows 7… however after following the basic first steps I seem to have completely borked something as basic hello world pages are not working (page not found).

    Can anyone help point me to details about a correct install folder structure or provide help with what I’ve got so far?

    c:\xampp\htdocs\codeigniter\

    and thus:

    c:\xampp\htdocs\codeigniter\application\[models|views|controllers]

    Is this correct or have I done something dumb…  e.g. is the “codeigniter” directory supposed to be there or should “application” and “system” be dropped directly inside the htdocs directory?

    Even if someone has a basic setup with a single working Model, View, & Controller as a package I could peek at I’d love to see the setup… Its driving me nuts that I can’t seem to get a simple setup to work.

  • #2 / Dec 02, 2012 10:36pm

    Jason McCallister

    255 posts

    When you install XAMPP the default site runs in the htdocs directory. Therefore, http://127.0.0.1/ would resolve to C:\xampp\htdocs.

    If you are placing CI into a new directory, such as CodeIgniter, you would have to view the url: http://127.0.0.1/CodeIgniter.

    So the structure would look like this:

    c:\xampp\htdocs\codeigniter\
    c:\xampp\htdocs\codeigniter\index.php
    c:\xampp\htdocs\codeigniter\system
    c:\xampp\htdocs\codeigniter\application
    c:\xampp\htdocs\codeigniter\user_guide

    However, if you dropped the application, system, index.php and user_guide directly into the htdocs directory it would resolve at http://127.0.0.1/index.php.

    That being said, the advantage to placing the files inside the CodeIgniter directory means that you could run more than one application at a time (i.e http://127.0.0.1/codeigniter/ and http://127.0.0.1/codeigniter-2/).

    Also, if you rename the system or application directory be sure that you change the index.php to reference the name changes.

    Does that help a little bit?

  • #3 / Dec 03, 2012 12:52am

    phpsenior

    1 posts

    You can change for .

  • #4 / Dec 03, 2012 6:58pm

    steve_web

    2 posts

    Thanks, it does help to know that I haven’t completely messed things up and that it should work as installed in my htdocs directory.

    However since my environment isn’t working properly at all I think I’m going to backup any code I’ve created so far and try re-installing both xampp and CI.

    As I run through the steps next time I’ll post a question as soon as I get stuck which will hopefully find the root cause of my install issue(s). 😉

    ...

    Does that help a little bit?

  • #5 / Dec 04, 2012 5:20am

    Ckirk

    108 posts

    Just a quick check
    http://localhost    - should run the xampp default directory. If not then this is your problem

    also check your hosts file (normally found in “C:\windows\system32\drives\etc\”)
    make sure it contains these 2 lines and they are not commented (remove any “#” prefix)

    127.0.0.1       localhost
    ::1             localhost


    Also as a rule any new codeigniter site that I make i make an entry in the host file for that site

    127.0.0.1       mynewsite

    And so the url to this site is http://mynewsite

    In addition to that I place my codeigniter site somewhere other than the htdocs folder.
    eg: D:\webdev\mynewsite

    Finally in the file c:\xampp\apache\conf\extra\httpd-vhosts.conf
    my setup for all my sites (including xampp) will look like this:

    #
    # Web site(s) dev environments
    #
    NameVirtualHost *:80
    
    <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "D:\webdev\mynewsite"
    <Directory "D:\webdev\mynewsite">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted 
    </Directory> 
    ServerName mynewsite
    </VirtualHost>

    any changes you make to the apache conf file require the apache server to be restarted.
    Also you should note that all the additional lines for mynewsite are in the conf file purely because I need to set permissions up as it’s not in the installed htdocs filder (which has all permissions).
    If you want to continue to use htdocs then just set the mynewsite section in the conf file as follows:

    <VirtualHost *:80>
    DocumentRoot "C:\xampp\htdocs\mynewsite"
    ServerName mynewsite
    </VirtualHost>

     

    Hope that’s of some help to you

  • #6 / Dec 04, 2012 5:23am

    Ckirk

    108 posts

    Note: These settings are for the latest apache version which you will have as you’re using the latest xampp.
    For anyone wishing to do this on an older version of apache the conf file is configured differently

  • #7 / Dec 04, 2012 9:17pm

    steve_web

    2 posts

    Thanks @Ckirk that was helpful and things seem to be working now… or at least working more.

    I’ll continue with what I have then and see if I can’t get a dynamic page to work. 😉

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases