By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,155 Members | 952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,155 IT Pros & Developers. It's quick & easy.

PHP/Apache setup for localhost

P: n/a
Hi all,

I've been doing ASP.NET C# for 4 years now and that's around the same
# of years I've been away from PHP. But now I'm looking at this PHP
position that looks really interesting to me. However, I have some
unresolved questions setting up my own test enviroment having bunch of
sites relative to http://localhost with each site having it's own
subdirectories and an include file (ex. Site Navigation with images
that's accessible from any subdirectories).

Ex.
http://localhost/site1
http://localhost/site1/products
http://localhost/site1/images
http://loclahost/site1/myinclude/inc.php

http://localhost/site2
http://localhost/site2/products
http://localhost/site2/images
http://loclahost/site2/myinclude/inc.php

Now let's say my inc.php file has bunch of images in it stored in /
site1/images folder. How do I setup php / apache so that I can
reference my images from the inc.php file from any folder/subfolder.
For example if I use /images/image.jpg it would fail since it would
take me to the root of localhost/images which is wrong. How can I have
it so that it goes to site1?? Also, in IIS you can setup virtual
folders. How do you setup virtual sites http://localhost/site1?
http://localhost/site2?
My main concern is only on my local computer. Because on production
server referencing /images would resolve my issue.

Thank you
M.
Apr 2 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ma*******@gmail.com wrote:
Now let's say my inc.php file has bunch of images in it stored in /
site1/images folder. How do I setup php / apache so that I can
reference my images from the inc.php file from any folder/subfolder.
You can configure PHP to look for a specific directory when including PHP
files - I'm not sure what you mean with "referencing images" - relative
URLs is a different issue.
http://www.php.net/manual/en/ini.cor...i.include-path
For example if I use /images/image.jpg it would fail since it would
take me to the root of localhost/images which is wrong. How can I have
it so that it goes to site1??
mod_redirect !
Also, in IIS you can setup virtual folders. How do you setup virtual sites
http://localhost/site1? http://localhost/site2?
With apache, you don't set "virtual folders" - you set "virtual hosts". See:

http://httpd.apache.org/docs/2.0/vhosts/examples.html
My main concern is only on my local computer. Because on production
server referencing /images would resolve my issue.
Can I ask why?

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
Apr 2 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.