This may appear as child problem but i have confusion about this When we document Root what this means??

I am creating directory strucure for framework eg
this is directory structure from code tutsplus

`----public Document root where public files are accessed
      -css
      -images
           -content
      -js
------ Resources 
      -library
      -template
      -config.php

about above structure someone has commented ** this puts credentials inside the doc root meaning it may get publicly available at some point**
what does it means??
this is confusing for me help?

I have xampp installed and has codeigniter projects in htdocs folder so which is document root htdocs or my project folder??

Recommended Answers

All 5 Replies

From the structure I see I guess that you put your php source code under public_html . Is there any reason for that ? Is php “public files” ? Generally speaking php and whatever is meant for source code are going in a src folder above public_html. What could stay in public_html in some implementations would be just an index.php (or whatever) containing only the instantiator of the front controller / initializer in MVC or anything like that in other architectural approaches .

commented: did you think resource folder is under public +0

NO it's not my directory structure i have just taken example of directory structure i want to know how it works if say document root what does it mean?how can my directory structure be compromised and how? I have searched for it but it only make me confuse

Hello Sunny , there are many ways to organize folders. One way is the source code (e.g. PHP + settings file) goes under src folder and what is meant to be public under public_html (or www) folder. I am not sure what the Resources folder contains there , maybe it is the src and if it isn't under the public_html then we are talking about the same thing.

Having php code in the public_html folder may be dangerous because you don't control how those files will be used (the order of those). Even if you use well organized classes and there are under public_html you still can't be sure of how these are going to be used. There are also many ways to make the flow more secure if you have source code under public_html , but you don't have any reason to , putting PHP in a folder above public_html will remove that worry.

Of course there will always be a small php file e.g. index.php that .htaccess will rewrite to it. But this isn't meant to have any logic to it only to call Front Controller in MVC or any other instantiator in any architectural approach.

ok i think i made the mistake in ---- representation

/public Document root where public files are accessed
      `    -css
          -images
               -content
          -js
/Resources 
          -library
          -template
          -config.php

`

resource folder will be outside public html now does it make sense??

commented: Yes it does make sense (we are talking about the same thing only different folder names) , and it is the moste reasonable approach in my point of view +8

ahh jkon thnks i cleared my doubts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.