my images are not displaying

Problems with the Windows version of XAMPP, questions, comments, and anything related.

my images are not displaying

Postby mayada » 13. August 2006 16:26

Dear all,

I am using xampp for windows, my OS is windows XP prof.

I am building some web pages but images and pictures are not displayed in the browser. I read this in the xampp FAQ:

With some applications (phpEclipse, phpBB etc.) are problems with displaying great files rpictures. This problem can be solved in the /xampp/Apache/conf/httpd.conf these lines
# EnableSendfile offstage
# EnableMMAP offstage
Please activate these lines by removing #:
EnableSendfile offstage
EnableMMAP offstage
Apache restart.

Conversly sometimes, from
EnableSendfile offstage
EnableMMAP offstage
you should make
# EnableSendfile offstage
# EnableMMAP offstage


When i view my httpd.conf, those lines actually read:

Enable Sendfile off
EnableMMAP off

The are both enabled. I tried different things:
1) i changed the "off" to "offstage" in both lines but when I stop and start Apache it does not start
2) I commented out both lines but my images still don't display.

Help me please!

Many thanks
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby Izzy » 14. August 2006 00:21

Double check your html code and the paths to your images also check your paths in the XAMPP conf files.

What browser are you using?

Right click on an image container that does not display and select Properties.
This may give a clue as to paths or other errors for the image etc.
This is browser dependant and I know that Firefox and SeaMonkey both have this facility.

Do you have any problems with other web sites displaying content in your browser on the Internet?

Clear your browser's cache and set you browser to refresh the page on every visit when you are in development mode. This can be switched back when surfing normally.
The browser cache is your enemy when developing and testing web sites.

Try checking using different browsers.


Only 2 variables here.
EnableMMAP Off|On
EnableSendfile Off|On
Default is Off

Try:
EnableMMAP On
EnableSendfile On

If you have virtual hosts then these directives go within the Directory container:
<Directory "/path-to-your-site-files">
EnableMMAP On
EnableSendfile On
Other Directives
</Directory>

http://httpd.apache.org/docs/2.0/mod/co ... enablemmap
http://httpd.apache.org/docs/2.0/mod/co ... lesendfile

Also try adding this:
Win32DisableAcceptEx
to the end of your httpd.conf file

If that does not work then comment it out as this is the default:
#Win32DisableAcceptEx

Note:
When ever you change anything in apache conf files you should check the syntax before restarting apache:
At a command prompt in
xampp/apache/bin apache -S for httpd-vhosts.conf syntax
xampp/apache/bin apache -t for httpd.conf syntax

If all is Syntax OK then restart apache


If all else fails try an absolutely clean uninstall of XAMPP. Then reinstall to a directory without any spaces in the title and only 1 xampp directory.
For example try install to C:\
You would then have C:\xampp\xamppfilesdirectories
XAMPP is not fond of spaces in directory or file names.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby mayada » 14. August 2006 02:21

Hi, thanks for replying.

I am using internet explorer version 6.

i did the recommended steps and here is the result:

1) the image path is correct in my html code: <img src="../images/firstlogo.JPG" width="326" height="39">
2) the properties of the image shows the path as: http://du_mayada/musicdept/images/firstlogo.JPG

Note: du_mayada is the localhost name.
also Note: the image is saved in c:/program files/xampp/hotdocs/musicdept/images/firstlogo.JPG AND my php/html script that is trying to pull the image is in c:/program files/xampp/hotdocs/musicdept/home

3) I have replaced

EnableMMAP Off
EnableSendfile Off

to

EnableMMAP On
EnableSendfile On

That didn't work

4) I am not sure what you mean virtual hosts - I guess since I don't know them, I am not using them :)

5) I've added Win32DisableAcceptEx
to the end of my httpd.conf file

That didn't work also.

I am not very keen on re-installing xampp. It took me some time to get mySQL working. Unfortunately, I've not documented the configurations I made and i don't want to lose them. I have a major deadline to meet and can't start all over again

I wonder if there's any other workaround
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby Wiedmann » 14. August 2006 03:01

2) the properties of the image shows the path as: http://du_mayada/musicdept/images/firstlogo.JPG

- What happens if you use this URI in the address bar from Internet Explorer?
- Can you see this request in the error or access log?

BTW:
Can you open the picture with the hostname "localhost" or 127.0.0.1?
http://localhost/musicdept/images/firstlogo.JPG
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby mayada » 14. August 2006 03:49

i tried the 3 options (opening the url from IE, replacing the host name with localhost and with 127.0.0.1.

In all cases I get this:

Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404
127.0.0.1
08/14/06 03:44:14
Apache/2.2.2 (Win32) DAV/2 mod_ssl/2.2.2 OpenSSL/0.9.8b mod_autoindex_color PHP/5.1.4


I am not sure where to view the error/access log that you mentioned.
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby Izzy » 14. August 2006 03:55

mayada wrote:...I am not sure where to view the error/access log that you mentioned.

xampp/apache/logs/
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Izzy » 14. August 2006 04:22

You could try to set up a virtual host so the server can understand what is going on here.
It seems to be confused what is localhost and what is a servername. We can help this confusion by creating a virtual host for du_mayada and a default location for the localhost.

First you should have the installed defaults put back in httpd.conf.
Change them back if you made any changes.
Check syntax for the httpd file.
In xampp/apache/bin
at a command prompt issue this:
apache -t
Save and restart Apache if Syntax OK


Add these entries to the bottom of:
xampp/apache/conf/extra/httpd-vhost.conf
but change any path details I may have wrong.
Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/program files/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
ServerName du_mayada
DocumentRoot "C:/program files/xampp/htdocs/musicdept"
<Directory "C:/program files/xampp/htdocs/musicdept">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Check syntax for the virtual host file.
In xampp/apache/bin
at a command prompt issue this:
apache -S
Save and restart Apache if Syntax OK

Now try your images again.

There is also an entry in your:
C;/windows/system32/drivers/etc/hosts file that you can look at.
127.0.0.1 localhost
127.0.0.1 du_mayada
You may wish to try the above first then try the virtual host addition after. Either way you can keep the edits in the hosts file.

Edit
hotdocs to htdocs may be the only thing you need to change as pointed out by Weidmann. Looks like a typo. I changed my copy/pastes above that reflected your typo. ;)
Izzy wrote:Double check your html code and the paths to your images also check your paths in the XAMPP conf files.
/Edit
Last edited by Izzy on 14. August 2006 05:56, edited 4 times in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Wiedmann » 14. August 2006 04:29

http://localhost/musicdept/images/firstlogo.JPG
Code: Select all
Object not found!
Error 404

OK, your problem have nothing to do with EnableSendfile, EnableMMAP, Win32DisableAcceptEx . Please restore the original settings.

With the above URI and error message you have no file:
c:/program files/xampp/hotdocs/musicdept/images/firstlogo.JPG

or your DocumentRoot is not:
c:/program files/xampp/hotdocs

Please look in phpinfo for the correct directories:
http://localhost/xampp/phpinfo.php

BTW:
What is:
c:/program files/xampp/hotdocs/

The normal DocumentRoot should be:
c:/program files/xampp/htdocs/
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby mayada » 14. August 2006 10:11

Hi,

I am sorry about the hotdocs, that was a typo. the correct folder name is htdocs (created automatically by xampp, I've not created it)

1) Document root in http://localhost/xampp/phpinfo.php is: DOCUMENT_ROOT C:/Program Files/xampp/htdocs (this is what I am using and is correct)

2) I do have firstlogo.JPG in the path I provided.

3) I am not sure how to do your suggestion:

In xampp/apache/bin
at a command prompt issue this:
apache -t
Save and restart Apache if Syntax OK


what command prompt and how do I navigate to that path if my cmd is showing another path?

By the way, I must mention that I did the default installation of xampp (using windows installer), I have not added any add ons; does that make a difference? have I missed anything?


Many thanks for all your help
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby mayada » 14. August 2006 10:50

By the way, I forgot to mention that the object not found error message I got, always shows the local host as I used it.

If I use "localhost" it shows: Error 404
localhost

If I use the ip address 127.0.0.1 it shows: Error 404
127.0.0.1

I am not sure if you were referring to this when you said the system is confused about server name
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby Izzy » 14. August 2006 11:21

mayada wrote:3) I am not sure how to do your suggestion:

Click on Start - bottom left of your TaskBar
Click on Run
Type cmd.exe
Now you have a command prompt >
type cd C:\Program Files\xampp\apache\bin
Type apache -t

Please paste the results obtained from the above command.

Please Paste the error message from:
xampp/logs/error.log
just after you have tried to access the image file in your browser.

A 404 file not found means the server can't find the file that you have said is where it is.

Maybe change the case of the image file to all lower case. jpg instead of JPG. (it should not make a difference but maybe try it any way).
Then call it in your browser with the lowercase image extension.
http://localhost/musicdept/images/firstlogo.jpg
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby mayada » 14. August 2006 12:00

the error:

File does not exist: C:/Program Files/xampp/htdocs/musicdept/images/logo2.jpg


:x I am going mad, the file DOES exist! I have many images in that directory and none of them is displayed.

Here is how I am pulling one of the images in my script:

<TD width=100% align=left valign=top><img src="../images/Universitylogo2.jpg"></TD>

Would you like me now to add the code below to xampp/apache/conf/extra/httpd-vhost.conf and try again and check the error log?

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot "C:/program files/xampp/htdocs"
ServerName localhost
</VirtualHost>

<VirtualHost *:80>
ServerName du_mayada
DocumentRoot "C:/program files/xampp/htdocs/musicdept"
<Directory "C:/program files/xampp/htdocs/musicdept">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Postby Izzy » 14. August 2006 12:14

I know this kind of thing is frustrating but there is a logical answer somewhere, we just have to investigate it and find the answer.

So first please paste you httpd.conf file in total here.

Paste the results of apache -t

Paste the last few lines of the xampp/logs/error.log with the errors from your attempts to load the images.

Hold off on the virtual host entry until the above pastes have been seen.

Have you changed any other conf files on your server?
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Postby Wiedmann » 14. August 2006 12:19

2) I do have firstlogo.JPG in the path I provided.

One test. Open a command prompt (cmd.exe) and execute this command:
Code: Select all
dir "c:\program files\xampp\htdocs\musicdept\images\firstlogo.JPG"

What's the output?

Would you like me now to add the code below to xampp/apache/conf/extra/httpd-vhost.conf

You have trouble with XAMPP, not solved it yet, but want already run in the next trouble?
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby mayada » 14. August 2006 12:46

All,

I am going to be too brave and admit that I was stupid :oops:

just simple checking of one of my images, I realised the image names were slightly changed (by removing the numbers) but my html code was still pulling the old names. I have corrected the img src path and it's working now!

I am going to blame this for the fact that I have slept a total of 2 hours in the last 48 hours, working on this project!


SO sorry for wasting your time. I concentrated on checking complex things and did not focus when I was checking the basics as suggested by all of you! But hey, I've learnt great things today (starting from simple things like how to change directories in command prompt). Plus I've learnt a lesson the hard way - CHECK CHECK and CHECK the basics before you panic! Also, have enough sleep before you work on programming :)

Many thanks all
mayada
 
Posts: 12
Joined: 30. July 2006 17:02

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 67 guests