Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Trying to Set up Virtual Folder Running Apache 2.2


  • Please log in to reply

#1
KingTheoden

KingTheoden

    Member

  • Member
  • PipPip
  • 21 posts
Hey guys, sorry to bother you with some rather elementary woes. I am using the book Beginnings PHP5 and MySQL E-Commerce and am stuck at Chapter 2.

My default folder for Apache is C:/htdocs. I created a folder C:/tshirtshop, created a simple php info page in this folder, and have added the following code to my httpd.conf Apache file (I am providing context, so my code is in bold)"

<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://localhost/bar

#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
Alias /tshirtshop/ "c:/tshirtshop"
Alias /tshirtshop "c:/tshirtshop"

#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/cgi-bin/"

</IfModule>


I really appreciate your dedication and assistance (hopefully I will eventually become skilled enough to return the favor). I am running Windows XP Professional SP2. PHP version 5.2.
  • 0

Advertisements


#2
KingTheoden

KingTheoden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 21 posts
Oh wow, an entire paragraph fell out.

The problem is that I get a 403 access error when I attempt to access a file in my virtual folder, i.e. when I type out the url localhost/tshirtshop/test.php, I get a 403 access error.
  • 0

#3
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
I'm not sure if this will help or if it matters, but in general a physical path uses back slashes "\" IE: c:\tshirtshop and virtual paths use forward slashes "/" IE: /tshirtshop/

So you might try:

Alias /tshirtshop/ "c:\tshirtshop\"
Alias /tshirtshop "c:\tshirtshop"


Or

Alias /tshirtshop/ "c:\tshirtshop"
Alias /tshirtshop "c:\tshirtshop"


Also ScriptAlias might need to look like this:

ScriptAlias /cgi-bin/ "C:\Program Files\Apache Group\cgi-bin\"

Edited by gunner12, 03 January 2008 - 07:26 AM.

  • 0

#4
KingTheoden

KingTheoden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 21 posts

I'm not sure if this will help or if it matters, but in general a physical path uses back slashes "\" IE: c:\tshirtshop and virtual paths use forward slashes "/" IE: /tshirtshop/

So you might try:

Alias /tshirtshop/ "c:\tshirtshop\"
Alias /tshirtshop "c:\tshirtshop"


Or

Alias /tshirtshop/ "c:\tshirtshop"
Alias /tshirtshop "c:\tshirtshop"


Also ScriptAlias might need to look like this:

ScriptAlias /cgi-bin/ "C:\Program Files\Apache Group\cgi-bin\"


Thank you for your reply. I will give it a shot, but I think the slashes are not the problem. When I enter as a url, http://localhost/tshirtshop/test.php, I get a 403 error. This indicates to me that while Apache is mapping to the folder, it will not let me access it. So maybe I have to grant access privileges somehow?

To iterate, my default folder for localhost server requests is C:/htdocs. Everything has worked flawlessly with php, MySQL, and Apache up to this point. I am trying an exercise in virtual folders, which is not working.
  • 0

#5
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
I dont know why I was thinking it was a 404 error, maybe I need some more coffee! :)

I dont know how to set permissions on an Apache server so I can't help you there, sorry.
  • 0

#6
KingTheoden

KingTheoden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 21 posts

I dont know why I was thinking it was a 404 error, maybe I need some more coffee! :)

I dont know how to set permissions on an Apache server so I can't help you there, sorry.


Haha no problem - thanks for the attempt!
  • 0

#7
KingTheoden

KingTheoden

    Member

  • Topic Starter
  • Member
  • PipPip
  • 21 posts
Topic solved!

The two changes I made are as follows. In the alias_module...

<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://localhost/bar

#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
Alias /tshirtshop/ "c:/tshirtshop/"
Alias /tshirtshop "c:/tshirtshop"


#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/cgi-bin/"

</IfModule>

I moved up the two alias paths (I do not think this had anything to do with the problem, but am noting it for precision). I also added a forward slash after the absolute location. This slash is in maroon.

Now how do I signify that the topic is solved?!
  • 0

#8
gunner12

gunner12

    Member

  • Member
  • PipPip
  • 46 posts
Glad you solved. it I thought it had something to do with the paths.

Now how do I signify that the topic is solved?!

You just did by saying so, no need to close the topic unless Admin wants to.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP