Environment Modifications

Your environment, as defined in the installation chapters of this book, need not change to handle localized Web sites. Although you can use several language-related settings in Apache, PHP, and MySQL to accommodate localized Web sites, you can also perform all the tasks in this chapter without making any language-related changes to your configuration. Just for your own information, the next few sections point you to the appropriate documentation for internationalization using Apache, PHP, and MySQL.

Configuration Changes to Apache

In Chapter 27, "Apache Performance Tuning and Virtual Hosting," you will learn about the concept of content negotiation using the mod_mime or mod_negotiation modules and the AddLanguage and AddCharset directives (among others). These directives are used when you manually change the extension of your file and want Apache to interpret the character set to be used, based on that extension. However, that is not what we're talking about in this chapter. You want all your localized Web sites to have the same file-naming conventions (such as index.html and company_info.html) and not have to manually create multiple pages with different language-based extensions to accommodate translated files. Your goal regarding Web site localization is to have a single set of pages filled with the appropriately translated text running from one Web server.

By the Way

There's nothing wrong with Apache-based content negotiation using multiple files with language-based naming conventions. It's just not the focus of this chapter. You can read more about Apache-based content negotiation at http://httpd.apache.org/docs-2.0/content-negotiation.html.

Configuration Changes to PHP

As with Apache, no configuration changes in PHP are required for any tasks in this chapter. However, you can use a host of functions related to the handling of multibyte characters, if you so desire. These functions are found in the PHP manual at http://www.php.net/mbstring and must be enabled during the configuration process using this code:


Here, LANG is a language code, such as ja for Japanese, cn for simplified Chinese, and so forth. Or, you can use this line to enable all available languages:


When mbstring functions are enabled in PHP, you can set several options in the php.ini configuration file to properly use these functions. After this is configured, you can use any of the more than 40 mbstring-related functions for handling multibtye input in PHP.

The manual entries for these functions are comprehensive and are recommended reading for advanced work with multibyte character sets and dynamic content.

You will get by just fine in this chapter without them, although it is recommended that at some point you peruse the PHP manual for your own edification.

Configuration Changes to MySQL

As with Apache and PHP, no explicit changes are needed in MySQL for the localization examples used in this chapter. The default character set used in MySQL is ISO-8859-1, but that does not mean that you are limited only to storing single-byte characters in your database tables. Personally, I have an application that shares MySQL database tables with their normal ISO-8859-1 character set configuration, in which the tables contain English, German, Japanese, and simplified Chinese characters. This usage is partly because grand internationalization and localization features aren't planned for implementation until MySQL 4.1 (see Chapter 32, "Features and Backward Compatibility of MySQL 4.1") and partly because the implementation works fine for my client's needs.

For more information on the current language-related elements of MySQL, read the MySQL manual entry at http://www.mysql.com/doc/en/Localisation.html.

Sams Teach Yourself PHP MySQL and Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (4th Edition)
ISBN: 067232976X
EAN: 2147483647
Year: 2003
Pages: 333
Authors: Julie Meloni

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net