Environment Modifications


Your environment, as defined in the installation chapters of this book, need not change to handle localized websites. Although you can use several language-related settings in Apache, PHP, and MySQL to accommodate localized websites, 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 29, "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 websites 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 website 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 want. 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:

--enable-mbstring=LANG


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:

--enable-mbstring=all


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

No explicit changes are needed in MySQL for the localization examples used in this chapter because the examples are not database-driven. 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. 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 (3rd Edition)
ISBN: 0672328739
EAN: 2147483647
Year: 2004
Pages: 327

Similar book on Amazon

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