Jump to content

Ideal directory structure for learning PHP


Recommended Posts

Hi--

Up until now, I have been using Dreamweaver MX 2004 on a WinXP machine to develop my website. On my local machine, I have kept my site directory under My Documents.

Recently, I have started learning PHP, and have downloaded XAMPP. Since I already have a website, I have access to a PHP webserver to test my PHP files and documents.

I have read that for many open-source configurations, I should store all my websites in the htdocs directory, which is directly under my C:\ drive.

Can you please tell me which I should do? Should I continue to keep my site under My Documents, or should I move everything to the htdocs directory? If I move everything to htdocs, what other files should I keep in the same directory?

Can you explain the pros and cons?

Thank you.

pdenlinger
Link to comment
Share on other sites

It sounds like you have a similar setup than I do on my laptop.

http://localhost/  ==  C:\www\Apache\htdocs

I keep a directory outside of htdocs where I keep htaccess password files and sql connects, but for the most part, htdocs has everything else. How you then setup your site is up to you, but since I have multiple projects with only one address, I have a directory for each.

/htdocs/projectA/

and these generally have the same subdirs

/htdocs/projectA/cls
/htdocs/projectA/css
/htdocs/projectA/js
/htdocs/projectA/docs
and maybe
/htdocs/projectA/tpl
Link to comment
Share on other sites

  • 3 weeks later...
HI

Can u please tell me about.
htaccess file.

and how to use it..
Please let me know


Regards

Sushant

[quote author=bibby link=topic=122377.msg509610#msg509610 date=1169361253]
It sounds like you have a similar setup than I do on my laptop.

http://localhost/  ==  C:\www\Apache\htdocs

I keep a directory outside of htdocs where I keep htaccess password files and sql connects, but for the most part, htdocs has everything else. How you then setup your site is up to you, but since I have multiple projects with only one address, I have a directory for each.

/htdocs/projectA/

and these generally have the same subdirs

/htdocs/projectA/cls
/htdocs/projectA/css
/htdocs/projectA/js
/htdocs/projectA/docs
and maybe
/htdocs/projectA/tpl

[/quote]
Link to comment
Share on other sites

htaccess file is basically an external configuration file for Apache which is read during run time (when viewing a directory/file on the server). With htaccess you can give each directory under the document root a different set of settings. htaccess files work on a per directory basis and all other subsequent folders are affected too, for example say your setup is this:

c:\htdocs
  |
  +--folder1
  |  |
  |  |-.htacces
  |  |
  |  +--- sub-folder1
  |  |
  |  +--- sub folder2
  |
  +--- folder2

all files/folders in the htdocs folder will abide by the Apaches main configuration. However sub folder1 and sub folder2 inside folder1 and folder1 itself will also abide the configuration from the .htaccess file in folder1. folder2 will not be affected or any file/folder outside of folder1

For the ideal directory structure I install everything webserver related into the root of hard drive in a folder called Server. It looks like this:
[code]C:\Server
  |
  +--- Apache2
  +--- MySQL
  +--- PHP
  +--- www (this is where i store my files, not Apache2/htdocs)[/code]

I have also got phpMyAdmin in the Server folder too and added an Alias to Apaches configuration so I can access it via the following url:
http://localhost/pma
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.