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
Standard User pmb00cs
(eat-sleep-adslguide) Tue 15-Feb-11 19:04:38
Print Post

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


[re: cheshire_man] [link to this post]
 
Not to sound patronizing, but have you checked that the IIS anon user has permission to write to the file?

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User cheshire_man
(fountain of knowledge) Wed 16-Feb-11 19:15:50
Print Post

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


[re: pmb00cs] [link to this post]
 
Nothing patronizing about that, it's not something I'd though about nor to my recollection, done anything about when I first installed IIS and got it all working.

However...

It's all happening on the one PC, this one. So IIS and the website data files are all on this PC albeit on a different logical drive. The username is the same as before, mine, as I'm the only user.

At the Web Sites branch of the IIS tree and going to Properties / Directory Security / Edit Anonymous Access it refers to a user name IUSR_computername with a password of something or other. Not sure whether that's what you're referring to. But I'm almost certain I didn't change anything in that area before the rebuild.

Tony
Standard User pmb00cs
(eat-sleep-adslguide) Wed 16-Feb-11 19:44:23
Print Post

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


[re: cheshire_man] [link to this post]
 
Sort of what I'm talking about.

The NTFS file permissions on the files that are being written too by IIS need to allow the IIS user to write to them.

This can be acheived either by giving the "everyone" group the necessary permissions (not a good idea in a production environment, but not so bad in a test environment) or by specifically granting the permissions to the IUSR_computername user.

I'm not saying this is the issue. But it does warrant checking.

If you have the folders on a second drive, and have copied them manually I would suspect that the "everyone" group already has permission, unless specifically set not to.

However, you have stated that you reinstalled XP, in which case the NTFS permissions may still be referencing the UUIDs of the users and groups of the old installation, and so may not work as expected.

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User cheshire_man
(fountain of knowledge) Wed 16-Feb-11 21:14:16
Print Post

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


[re: pmb00cs] [link to this post]
 
I couldn't see how to change the group permissions, Windows Explorer didn't give me the choice.

Howsoever, as the file was only a 4 byte test file with a count in it I created an appropriate text file on the C: drive, copied to the test folder, and bingo it worked! And the approach also worked for the other two test sites I run under IIS.

As it is purely a very local test environment and is never exposed to web access, permissions are less relevant than they would be if it were web visible.

Many thanks for guiding me to a solution.

Tony
Standard User pmb00cs
(eat-sleep-adslguide) Wed 16-Feb-11 21:19:10
Print Post

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


[re: cheshire_man] [link to this post]
 
No problem, glad I could be of service.

For reference, to change file permissions you first need to turn off simple file sharing (which works in exactly the same way as none simple file sharing under the hood, it just doesn't let you tune the permissions properly) and then in the properties box will be a security tab. This is where to edit permissions.

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User cheshire_man
(fountain of knowledge) Wed 16-Feb-11 21:22:59
Print Post

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


[re: pmb00cs] [link to this post]
 
Ah, that option at the end of the Folder Options View list, not played with that - yet smile

Tony
Standard User pmb00cs
(eat-sleep-adslguide) Wed 16-Feb-11 21:38:42
Print Post

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


[re: cheshire_man] [link to this post]
 
One word of warning, when messing with NTFS permissions NEVER set a deny permission on the "everyone" group, and only set deny permissions on groups if you are sure that you will be able to unset them (Do not add the local admin account to any effected groups, for example)

happily chugging along on plusnet and Virginmedia (yes I am greedy)
My web server
Standard User cheshire_man
(fountain of knowledge) Wed 16-Feb-11 22:31:09
Print Post

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


[re: pmb00cs] [link to this post]
 
Yes, I've had experience of settings various permissions on Windows Servers, always good fun. And on mainframe systems long before that. Care is indeed needed.

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

Jump to