Welcome Guest, Not a member yet? Register   Sign In
Exact location of CI files
#1

Hi Everyone,
I've been using CI for a few months and have a couple projects up and running. However, I'm not sure I performed the installation exactly as the manual says for optimum security....I'm now starting a third project and want to try to do it correctly.

The problem is I don't understand the manual's installation instructions in terms of where you are supposed to put the CI files. It says that index.php should be in your root. It also says that the application and system files should be ABOVE the root.

That should be clear, but I don't get it. I think I'm a little bit mentally challenged when it comes to file hierarchies...they are much much harder for me than coding stuff, so can someone please help?  

As of now my brand new site has simply the main folder,  www.mysite.com, and the folder inside it, called public. ...given that, where do I put the CI files?

This is a pic of my latest attempt: http://i.imgur.com/ZWDd8OU.jpg. Can someone please tell me if it is correct, or if not where to put the files?
Reply
#2

(This post was last modified: 03-22-2017, 01:17 PM by ciadmin.)

What I do, which is by no means the only way to handle this...

/htdocs/xxx is my project root, a.k.a my repository
/htdocs/xxx/application is my code
/htdocs/xxx/public is my documenet root, containing index.php, .htaccess & any images, CSS, etc
/htdocs/xxx/system is the framework

I map a subdomain virtual host entry to the public folder inside my project.

See https://github.com/jedi-academy/CodeIgniter3.1-starter1

ps - The above *is* the structure/strategy we are using for CodeIgniter4 Undecided
Reply
#3

Oooh, thank you, I like the idea of getting a jump on the way things are done in version 4!

The github link is awesome, thank you....I think I understand how it's set up, but just to be sure, would you be willing to look at this pic of how have it to let me know if it's correct?

http://i.imgur.com/mhaEoGF.jpg I blurred the top line but it is basically a folder that says mysitename.com:

Thank you!
Reply
#4

That is the idea. If you are using .htaccess to hide "index.php" in URLs, it would go inside public.
You would map your domain DocumentRoot to "mysitename.com/public/", not "mysitename.com/", and you should be in business.

ps The CodeIgniter 4 reference is *only* for the folder structure. It is a rewrite, and there will be many more changes, compared to CodeIgniter 3 Undecided
Reply
#5

(This post was last modified: 03-22-2017, 03:26 PM by cyclist. Edit Reason: typo )

Awesome, thank you! Thanks to your awesome github file as a model, I was able to get my new site running smoothly and index.php removed in just a few minutes.

I did end up having to put a ? after index.php in the .htaccess code:

http://stackoverflow.com/questions/61187...-specified.

Thank you again!
Reply
#6

(This post was last modified: 03-22-2017, 05:34 PM by John_Betong. Edit Reason: Spelling, not my forty :( )

(03-22-2017, 12:59 PM)cyclist Wrote: Hi Everyone,
I've been using CI for a few months and have a couple projects up and running. However, I'm not sure I performed the installation exactly as the manual says for optimum security....I'm now starting a third project and want to try to do it correctly.

The problem is I don't understand the manual's installation instructions in terms of where you are supposed to put the CI files. It says that index.php should be in your root. It also says that the application and system files should be ABOVE the root.

That should be clear, but I don't get it. I think I'm a little bit mentally challenged when it comes to file hierarchies...they are much much harder for me than coding stuff, so can someone please help?  

As of now my brand new site has simply the main folder,  www.mysite.com, and the folder inside it, called public. ...given that, where do I put the CI files?

This is a pic of my latest attempt: http://i.imgur.com/ZWDd8OU.jpg. Can someone please tell me if it is correct, or if not where to put the files?

I prefer having the CI files above the www.mysite.com folder  (also in a CI folder) because it is easy to upload a newer CI version into the CI folder and only the index.php->$system_path needs changing to run the CI version.


Also more than one application can be in the the public_html folder and the index.php->$application path pointed to another application.

Fortunately I run a Virtual Private Server hosting quite a few domains and every CI application has access to the common CI folder with a unique CI version.

If you are unable to visualize my setup I will endeavor to upload an image... when I am on the desktop.
Reply
#7

Hi John, yes, I would love to see a screenshot of the setup if it's not too much trouble!

I have three domains right now with three separate ci installs. I was wondering if I could somehow just install ci once, but ....aren't the autoload, route, config files all different?
Reply
#8

@John_Betong ... I used to setup my apps the way you do, but now have way too many apps, and prefer to update them (regarding CI version) 1 at a time, rather than all at once, in case something breaks. I have over 80 apps, using all versions of CI ... some of those are legacy and will not be updated.

A composer version of the framework might make it easier, or configuring it as a git submodule, although those strategies would still end up with a copy of CI inside each app.
Reply
#9

(03-22-2017, 06:07 PM)cyclist Wrote: Hi John, yes, I would love to see a screenshot of the setup if it's not too much trouble!

I have three domains right now with three separate ci installs. I was wondering if I could somehow just install ci once, but ....aren't the autoload, route, config files all different?

Here's my setup:
PHP Code:
var/www/ci2/
    /
Codegniter-3.1.0/system/
    /
Codegniter-3.1.1/system/
    /
Codegniter-3.1.2/system/                
    /
Codegniter-3.1.3/system/
    /
Codegniter-3.1.4/system/

var/
www/
    
html/public_tml/
        
index.php        
    site
-001.com/public_html/
        
index.php
        application
-001/        
        
application-002/        
        
application-003/        
    
site-002.com/public_html/index.php        
    site
-003.com/public_html/index.php        
    site
-004.com/public_html/index.php        
    site
-005.com/public_html/index.php        
    john_betong
.tk/public_html/index.php        

    
// common index.php
        
index.php -> 
        
# $system_path = 'system';
    
     # $system_path = '../../ci2/CodeIgniter_2_1_2/system';
     
     # $system_path = '../../ci2/CodeIgniter_2_1_4/system';
     
     ...
     
     # $system_path = '../../ci2/CodeIgniter-3-1-3/system'; 
         
 $system_path '../../ci2/CodeIgniter-3-1-4/system'// 2017-03-20

         # $application_folder = 'application-001';
         # $application_folder = 'application-002';
           
$application_folder 'application-003'
Reply
#10

(03-22-2017, 07:07 PM)ciadmin Wrote: @John_Betong ... I used to setup my apps the way you do, but now have way too many apps, and prefer to update them (regarding CI version) 1 at a time, rather than all at once, in case something breaks. I have over 80 apps, using all versions of CI ... some of those are legacy and will not be updated.

A composer version of the framework might make it easier, or configuring it as a git submodule, although those strategies would still end up with a copy of CI inside each app.

The setup detailed in my previous #post:
1.  only requires a single copy of the CI-Version 
2.  each index.php  uses $sytem_path to call any CI-Version
3.  each index.php  uses $application to call any Application-version
4. I think $appication can be set to call  the CI-version/application

I fail to see how Composer simplifies the version selection.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB