NYCPHP Meetup

NYPHP.org

[nycphp-talk] can't change charset on Apache vhost

David Mintz david at davidmintz.org
Tue Nov 30 15:31:04 EST 2010


Forget it! I think it's a php-related issue after all. If I am wrong and
can't figure it out, I'll be back! (-:

On Tue, Nov 30, 2010 at 3:19 PM, David Mintz <david at davidmintz.org> wrote:

> Running Apache/2.2.12 (Ubuntu) PHP/5.2.10 on my development machine, I have
> a few vhosts and I need one of them to serve iso-8859-1 rather than UTF-8.
> Try as I might, it remains UTF-8. I have added AddDefaultCharset ISO-8859-1
> to the vhost definition. In desperation I have also tried adding the same
> directive to httpd.conf and apache2.conf. Nothing works. Wondering if it had
> to do with PHP rather than static html, I have tried accessing a file that
> is indeed static:  same story.
>
> Wondering if there was something peculiar about this particular vhost, I
> have tried setting and resetting the same value in other vhosts and looking
> at the response headers after reloading the modified config, and it works as
> it's supposed to. So, the question is, what's different? Answer:  I don't
> know. Is the charset getting overridden by a local .htaccess file? No. Am I
> remembering to tell Apache to reload its config after changing its config?
> Yes.
>
> The offending host definition looks like this:
>
> <VirtualHost *:80>
> ServerAdmin david_mintz at nysd.uscourts.gov
> Servername interps3
> AddDefaultCharset ISO-8859-1
> DocumentRoot /var/www/interps3
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
> <Directory /var/www/interps3>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride All
> Order allow,deny
> allow from all
> </Directory>
>
>  ErrorLog /var/log/apache2/interps3.error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel warn
> CustomLog /var/log/apache2/access.log combined
> </VirtualHost>
>
> and yet...
>
>
> root at interps3:/etc/apache2/sites-available# curl -I interps3/index.php
>
> HTTP/1.1 200 OK
> Date: Tue, 30 Nov 2010 20:13:27 GMT
> Server: Apache/2.2.12 (Ubuntu) PHP/5.2.10-2ubuntu6.5 with Suhosin-Patch
> X-Powered-By: PHP/5.2.10-2ubuntu6.5
> Vary: Accept-Encoding
> Content-Type: text/html; charset=utf-8
>
> By the way, the reason I care is that there are MySQL tables defined as
> latin1 with accented characters that aren't getting displayed correctly, and
> I have been through this before and am reasonably certain that it's a
> charset mismatch issue.
>
>
> I am mystified. Any suggestions?
>
> Gratefully,
>
>
>
> --
> David Mintz
> http://davidmintz.org/
> It ain't over:
> http://www.healthcare-now.org/
>
>
>


-- 
David Mintz
http://davidmintz.org/
It ain't over:
http://www.healthcare-now.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101130/e2d67e75/attachment.html>


More information about the talk mailing list