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)"

<Directory "C:/tshirtshop">
Order allow,deny
Allow from all
</Directory>

<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


#
# 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.
#
Alias /tshirtshop/ "c:/tshirtshop"
Alias /tshirtshop "c:/tshirtshop"

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.

Recommended Answers

All 6 Replies

What is the problem ?

Hi KingTheoden

Could you please expline the issue?

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.

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/wamp/www"

and

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Satisfy all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/wamp/www">

Check those 2 lines in httpd.conf. If you give tshirtshop as the path, if you type localhost, you will get the list of files and folders in tshirtshop.

and


Check those 2 lines in httpd.conf. If you give tshirtshop as the path, if you type localhost, you will get the list of files and folders in tshirtshop.

Thank you for your reply.

But would that not change my default folder to C:/wamp/www? I do not want to pull up the tshirtshop folder as the default for localhost. I just want a file from the folder C:/tshirtshop to load when I type http://localhost/tshirtshop/test.php.

Apache seems to be mapping to the folder, however will not let me in (as it is a 403 error). I think the crux of the matter is some permission setting I have to make.

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 red.

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

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.