Strange problem with apache
Apologies if this is not in the right section of the forum, I figured it was a newb question and so would be ok here.
I've just configured a new server with Red Hat Enterprise 5 it's not our first linux machine and is running great except for one small detail, there is something missing in the apache config but I'm not sure where the problem is because both are running largely the same config as is installed by Red Hat. I have 2 URLs both running off apache 2, one works: http://demo.mybirth.tv/images/vidThu...£££%20%201.jpg the other doesn't: http://www.mybirth.tv/images/vidThum...£££%20%201.jpg I've narrowed it down to the file names because as soon as I take out the £££ it works. If that were just it then things wouldn't be a problem but these are user uploaded files and there are a lot of them so ideally I need to make the severs behave in the same way. If someone could point me to the right place in my httpd.conf then I'd be most grateful. |
The file name in the link that fails is rendered in the URL as: 'Acupuncture £££ 1.jpg'
the one that works gets rendered as: 'Acupuncture £££ 1.jpg' To me this suggests that there is a difference in the way the servers' character sets are configured. At least that is the first thing I would look at. |
Yeah that was my first thought too, I noticed that the old server had a whole load of additional AddCharset parameters in the httpd.conf so I copied those over and restarted apache but it didn't make any difference. I also tried putting them in the .vhost file for this site and, as a last resort in the .htaccess file. Nothing seemed to make any difference and I'm still getting 404 errors on the images :(
|
After some more investigation I've definitely worked out what the problem is. The locale setting the server upon which the URL works has it's locale set as
[ewar@linux3 lib]$ locale LANG=en_GB.UTF-8 LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL= The one that does not work is: [root@scotty vidThumbs]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= So the £ sign is not liked by the new one due to the locale. Cool, now I know what the problem is does anyone know an easy way to change the locale on a Red Hat ES5 server? I need to change it from US.UTF-8 to GB.UTF-8? |
man locale should give you an idea how to change the settings.
|
I've tried that but the man pages are not massively helpful. All I see is what I've pasted below, it doesn't actually tell me very much but maybe I'm just being uber-dumb :(
DESCRIPTION The locale program writes information about the current locale environment, or all locales, to standard output. When invoked without arguments, locale summarizes the current locale environment for each locale category defined by the LC_* environment variables. -a, --all-locales Write names of available locales. -m, --charmaps Write names of available charmaps. Output Format: -c, --category-name Write names of selected categories. -k, --keyword-name Write names and values of selected keywords. ENVIRONMENT VARIABLES LC_CTYPE Character classification and case conversion. LC_COLLATE Collation order. LC_TIME Date and time formats. LC_NUMERIC Non-monetary numeric formats. LC_MONETARY Monetary formats. LC_MESSAGES Formats of informative and diagnostic messages and interactive responses. |
For eg:
to change all locales to en_GB.UTF-8 locale -a en_GB.UTF-8 or to change a particular catagory locale -c <catagory-name> en_GB.UTF-8 |
Thanks for that, I tried this command
locale -a en_GB.UTF-8 but it simply printed a list of all the available locales and did not make any changes. I've been scouring the docs looking for the correct command but either I'm looking in the wrong place or I'm not seeing something that is staring me in the face :) |
alternatively you can export all the components individually to the value you want.
|
Thanks for your patience :) I tried:
[root@scotty vidThumbs]# locale -c LANG en_GB.UTF-8 To change the first of the components listed when one types locale I did not receive any output from my command but when I type locale the LANG=en_US.UTF-8 is still there, I would have expected it to change to en_GB.UTF-8 [root@scotty vidThumbs]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= |
OK, so I managed to change it. I reloaded my console and now when I type locale I see:
LANG=en_GB.UTF-8 LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL= Unfortunately the file names with £ in them are still generating 404 errors in apache :( http://www.mybirth.tv/images/vidThum...2%A3%20%20.jpg |
It seems to be some other issue. I tried both the links in your first post and both of them somehow contain the pound sign.
You might again want to look into the configuration of the server and that the is actually there on the server and the location of the file is same as that is configured in apache. |
The files are definitely on the server and the paths are also correct. Images without £ in them work as you can see on this page, each item listing in the centre has an image attached to it but only some of them show up.
http://mybirth.tv/a-z.cfm?cat=169 The images in the main list area of the page that show have no £ in the filename, the ones that don't do have them. If you compare it with http://demo.mybirth.tv/a-z.cfm?cat=169 All the images show on that page event though the file names are the same. When I do ls -l in the relevant folder on the server there is also something strange happening, on the server that serves the file it's listed as Acupuncture £££ 1.jpg on the server which doesn't serve the file it's listed as Acupuncture â¬Ãºâ¬Ãºâ¬Ãº 1.jpg Neither of them is a £ symbol but they are different and definitely suggest a problem with the locale. Might a restart of the server be necessary? It's unusual for linux that it would need to be restarted but I could always try it. |
I dont think that changing locales need restarting of server.
I remember doing this on solaris machines and changes took place without restart. You might just want to take that step as well just not to regret later but I suspect it will solve your problem. If you think that the pound sign is your problem, can you change the name for one file so that you can be just sure for that fact. Otherwise you will keep on finding solution for something that isnt your problem in first place. Anyhow, those both links in the above post#13 are working for me. |
I tried changing the filename and it works, it works if I take the £ out it also works with spaces and other characters that might be expected to cause a problem. I will definitely try a restart and see how that goes. Thanks so much for your help so far, I will let you know how I get on.
|
All times are GMT -5. The time now is 09:55 AM. |