Technical Discussion
  >> Web Design / HTML / Web hosting Forum


Register (or login) on our website and you will not see this ad.


Pages in this thread: 1 | 2 | (show all)   Print Thread
Standard User cheshire_man
(fountain of knowledge) Sat 12-Feb-11 21:18:45
Print Post

IIS & PHP on XP Pro - What am I doing wrong?


[link to this post]
 
I've rebuilt my PC and have reinstalled XP etc. on it.

Previously (thanks to the advice last August) I'd happily got IIS (5.1) and PHP (5.2) running on it to give me a test environment for a couple of web sites.

On the rebuilt PC I've installed IIS and PHP (5.3 this time) and can access the web site but some images are not appearing, without checking all pages it seems at least some are those reference inside an anchor tag, though there are some plain vanilla <img> images which aren't appearing, others are fine.

Also one site runs a small 'jukebox' to play selected mp3 files, this runs but cannot load the files though elsewhere ordinary anchor links to the same files work fine.

Clearly I've done something wrong or not set a parameter somewhere.

My guess would be it's an IIS issue but I could (easily) be wrong.

Any ideas good people?

Tony
Standard User pmb00cs
(eat-sleep-adslguide) Sun 13-Feb-11 01:26:16
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: cheshire_man] [link to this post]
 
What are the file references? Do they reference a file on your hard drive (do the file paths match?) or do you mean anchors in the HTML presented to the web browser (are the files readable by the IIS anon user account?)

Could be a number of issues. It all depnds on your set up, and what exactly you are trying to do.

Without more information, I assume the problem is that the files (images and mp3's) are being called by the browser and not returned (or not returned properly). If this is correct I would try and found out if the file permissions are correct, and if IIS is allowing anon access. I would also check the files are in the right place in regards to the Web Root folder.

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User cheshire_man
(fountain of knowledge) Sun 13-Feb-11 08:19:44
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: pmb00cs] [link to this post]
 
Without checking them all, I've just realised that the images that work are referenced by a tag of the form
<img src="images/general/abcd.jpg"
Those that don't work are of the form
<img src="/images/staff/ph1.jpg"
In other words the leading back slash seems to be the culprit.

In my limited understanding that suggests I haven't got the IIS set up quite right.

I should point out that the HTML has not changed since it all worked perfectly immediately before the rebuild 2 days ago so, whether or not it is strictly correct, I don't wish to (or see why I should) change the HTML.

Tony


Register (or login) on our website and you will not see this ad.

Standard User pmb00cs
(eat-sleep-adslguide) Sun 13-Feb-11 10:36:24
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: cheshire_man] [link to this post]
 
Ok, that helps a lot.


the
Text
1
<img src="images/general/abcd.jpg" />

tag tells the browser to request the image relative to the path of the page it is viewing so if you look at
Text
1
http://www.somedomain.com/foo/bar.html

then with that tag the picture requested would be
Text
1
http://www.somedomain.com/foo/images/general/abcd.jpg

whereas the
Text
1
<img src="/images/staff/ph1.jpg" />

tag tells the browser to look relative to the root folder so the browser will look for
Text
1
http://www.somedomain.com/images/staff/ph1.jpg

note that we have broken out of the foo folder.

So from this I conclude that previously you had the folder with everything in it set as the web root folder, but now it is set as a sub folder.

Basically move the web root up the directory structure on your hard drive and things should start working (may be one or more levels you need to move up)

or remove the leading slash from the src properties of your img tags.

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User camieabz
(legend) Sun 13-Feb-11 12:32:22
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: cheshire_man] [link to this post]
 
I use XAMPP for working with php files locally. I did, and it's been fine.

If you try it, be sure to read the thread linked, and sort out the 'root folder' issue that had me for a bit. iirc xampp starts you off in root/xampp/ which isn't always great for getting css and image files to work as you would like, if you use relative referencing with ../ etc.

~~~~~~~~~~



© Camieabz 2002-2011 - All rights and lefts reserved.

report this link
Standard User cheshire_man
(fountain of knowledge) Sun 13-Feb-11 14:30:52
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: pmb00cs] [link to this post]
 
I tweaked the IIS data in various ways and it's now working. Not entirely sure which tweak did it, possibly changing the 'default web site' to mine was the key.

Thanks for your suggestions.

Tony
Standard User ilh
(fountain of knowledge) Mon 14-Feb-11 09:22:15
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: cheshire_man] [link to this post]
 
That would do it. The leading / tells it to go to the web root directory and then find the images from there. Moving what it percieves to be the root would get it to look inthe right place smile

~ilh

The sooner you get behind, the longer you have to catch up.
Standard User cheshire_man
(fountain of knowledge) Mon 14-Feb-11 21:07:22
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: ilh] [link to this post]
 
Thanks, I'll readily admit things like this always cause me a headache.

I've just spotted one small, very small, thing.

In the home page I have a hidden hit counter. It's a very simplistic piece of code but it does what I need and worked under IIS previously, and of course works on the real web site. I've just noticed that there is an error message after the footer (that's why I didn't spot it earlier) saying
Warning: fopen(hitcounter.dat): failed to open stream: Permission denied in D:\Web Sites - test\AllHallows\pages\count.php on line 5
This is followed by various consequential messages. The PHP code reads
$COUNT_FILE = "hitcounter.dat";
if (file_exists($COUNT_FILE)) {
$fp = fopen($COUNT_FILE, "r+");
etc.
HITCOUNTER.DAT is in the root directory, same as INDEX.PHP. Clearly it's opening for read & write access.

Clearly I've again not got something quite right in IIS. Any thoughts on what I may have missed.

One of the real problems is that I couldn't see any way of backing up the IIS environment before the rebuild and being able to restore it afterwards.

Tony
Standard User ilh
(fountain of knowledge) Tue 15-Feb-11 09:35:27
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: cheshire_man] [link to this post]
 
I'm afraid I am not much help as I don't use IIS - I use xampp like camie. It obviously is finding the file as it gets through the if statement so it sounds like IIS might be blocking the file type. In fact a quick google suggests that you need to add the mime type yourself.

http://support.microsoft.com/kb/326965

It did say on something that I read that older versions of IIS allowed unknown file types but that is no longer the case smile

~ilh

The sooner you get behind, the longer you have to catch up.

Edited by ilh (Tue 15-Feb-11 09:36:01)

Standard User cheshire_man
(fountain of knowledge) Tue 15-Feb-11 13:50:46
Print Post

Re: IIS & PHP on XP Pro - What am I doing wrong?


[re: ilh] [link to this post]
 
I'm running IIS 5.1 and that refers to IIS 6. So wouldn't appear to be the problem.

As I said it's not an important issue but clearly one that I didn't have before and would prefer to solve, if only to understand it.

Tony
Pages in this thread: 1 | 2 | (show all)   Print Thread

Jump to