Tải bản đầy đủ (.pdf) (2 trang)

Tài liệu PHP and MySQL by Example- P17 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (148.86 KB, 2 trang )

E.7. Configuring php.ini (All Platforms)
Everything about the behavior of your PHP environment is set up in the file php.ini. On the Windows system, this file
is usually located in the C:\Windows\ directory. On Mac OS X and other UNIX-based platforms, this file is in the /etc/
directory.
You can edit this file directly with an editor such as Notepad on Windows or TextEdit on Mac OS X and vi or emacs on
most UNIX platforms.
If you modify the php.ini file with an editor, you will notice that it is just a text file consisting of name=value lines,
also known as name–value pairs. Lines that start with a semicolon are comments and are ignored by the system.
To change the behavior of your PHP environment, simply change the appropriate value in the php.ini file. Table E.1
lists some of the more common configuration options.
Table E.1. php.ini Configuration Options
Option
Explanation
short_open_tag
If this is on, you can use a short tag to indicate the beginning of a PHP code <?
instead of a default open tag <?php. This feature is usually on.
asp_tags
It this is on, you can use ASP-style tags <% and %>. Unless you just cannot change
your habits from ASP, it is recommend you not use this feature as it just generates
confusion.
error_reporting
Specifies the level of error reporting on this server. There are various options:
E_ALL means all errors are reported, E_ERROR is just for the fatal errors, and
E_NOTICE is for runtime notices. You can combine and negate certain errors. For
example, E_ALL & ~E_NOTICE means report all errors and do not report runtime
notices. This is the default setting. For other options, see the php.ini file.
display_errors
This option lets you turn error reporting on or off. For example, while you are
developing your Web site, you typically want to see all the errors but once your Web
site is live, you do not want your customers to see the error messages.
register_globals


PHP can optionally create variables for all the form data that was submitted. This is a
nice time-saving feature of the language and many programmers love it. However,
there are certain security issues with this feature and newer versions of PHP ship
with this option turned off by default. You should try to write your code so it does
not depend on register_globals being on.
magic_quotes_gpc
Another security feature of PHP to prevent users from submitting code that attacks
your database, PHP can “escape” dangerous characters and sanitize the user input.
This feature is on by default.
extension_dir
Sometimes you might have to update this setting, but basically it points to the place
where your PHP extensions are located.
SMTP
Specifies the SMTP server that PHP uses to send e-mail out. Default is localhost and
it will work on most UNIX systems. For Windows systems, you might have to
contact your ISP to find out what SMTP you can use.

Note that MySQL extensions are disabled in PHP 5 by default. To enable them, you must uncomment the line
extension=php_mysql.dll in the php.ini file by removing the leading semicolon.
E.8. Installing MySQL on Windows
For the most part, MySQL installation is a straightforward process. You need to download the latest MySQL server binary
by going to and selecting the Windows (x86) version for Windows, or
Standard version for Mac OS X.
Both of these installations will guide you through the setup process. For the most part, you simply need to agree to the
default settings. When prompted to specify a password for the superuser, aslo known as root user, select the word
“password” because our art gallery example assumes that root’s password is the word “password”.

Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
E.9. Installing MySQL on Linux/UNIX
For Linux platforms, the MySQL Server is provided as an RPM package. Most Linux platforms will have an RPM

package manager provided for installation of this package.
Detailed Linux installation instructions can be found at
E.10. Installing MySQL on Mac OS X
To install MySQL Server on Mac OS X, please visit
E.11. Read the Manual
The installation instructions change from version to version. If you run into problems, please read the manual that comes
with the download archive. Configuration settings that were turned on in the past, might now be turned off, and although
the directory structure might change, the manual is usually up to date.
Look for a file called README or INSTALL. They are usually text files and contain all the installation details.
CD-ROM Warranty
Prentice Hall PTR warrants the enclosed CD-ROM to be free of defects in materials and faulty workmanship under normal
use for a period of ninety days after purchase (when purchased new). If a defect is discovered in the CD-ROM during this
warranty period, a replacement CD-ROM can be obtained at no charge by sending the defective CD-ROM, postage
prepaid, with proof of purchase to:

Disc Exchange
Pearson Technology Group
75 Arlington Street, Suite 300
Boston, MA 02116
Email:
Prentice Hall PTR makes no warranty or representation, either expressed or implied, with respect to this software, its
quality, performance, merchantability, or fitness for a particular purpose. In no event will Prentice Hall, its distributors, or
dealers be liable for direct, indirect, special, incidental, or consequential damages arising out of the use or inability to use
the software. The exclusion of implied warranties is not permitted in some states. Therefore, the above exclusion may not
apply to you. This warranty provides you with specific legal rights. There may be other rights that you may have that vary
from state to state. The contents of this CD-ROM are intended for personal use only.
More information and updates are available at:
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.

×