1. Trang chủ
  2. » Giáo Dục - Đào Tạo

PHP, MySQL and apache tủ tài liệu bách khoa

645 112 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 645
Dung lượng 8,2 MB

Nội dung

Teach Yourself ® PHP, MySQL and Apache Julie C Meloni All in One 800 East 96th Street, Indianapolis, Indiana, 46240 USA Sams Teach Yourself PHP, MySQL and Apache All in One Acquisitions Editor Shelley Johnston Copyright © 2004 by Sams Publishing Development Editor Chris Newman All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein International Standard Book Number: 0-672-32620-5 Managing Editor Charlotte Clapp Project Editor Dan Knott Copy Editor Krista Hansing Library of Congress Catalog Card Number: 2003109401 Printed in the United States of America First Printing: December 2003 06 05 04 03 Trademarks All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an “as is” basis The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it Bulk Sales Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales For more information, please contact U.S Corporate and Government Sales 1-800-382-3419 corpsales@pearsontechgroup.com For sales outside of the U.S., please contact International Sales +1-317-428-3341 international@pearsontechgroup.com Indexer Sharon Shock Proofreader Mike Henry Technical Editor Chris Newman Publishing Coordinator Vanessa Evans Multimedia Developer Dan Scherf Designer Gary Adair Page Layout Julie Parks Contents at a Glance Introduction Part I: Laying the Groundwork CHAPTER Installing and Configuring MySQL Installing and Configuring Apache 27 Installing and Configuring PHP 51 Part II: PHP Language Structure CHAPTER The Building Blocks of PHP 71 Flow Control Functions in PHP 93 Working with Functions 115 Working with Arrays and Objects 135 Part III: Getting Involved with the Code CHAPTER Working with Strings, Dates and Time 153 Working with Forms 181 10 Working with User Sessions 203 11 Working with Files and Directories 213 12 Working with the Server Environment 237 13 Working with Images 245 Part IV: PHP and MySQL Integration CHAPTER 14 Learning the Database Design Process 262 15 Learning Basic SQL Commands 273 16 Interacting with MySQL Using PHP 321 Part V: Basic Projects CHAPTER 17 Managing a Simple Mailing List 335 18 Creating an Online Address Book 347 19 Creating a Simple Discussion Forum 371 20 Creating an Online Storefront 387 21 Creating a Shopping Cart Mechanism 399 22 Creating a Simple Calendar 413 23 Restricting Access to Your Applications 427 24 Logging and Monitoring Web Server Activity 449 25 Application Localization 467 Part VI: Administration and Fine Tuning CHAPTER 26 Apache Performance Tuning and Virtual Hosting 481 27 Setting Up a Secure Web Server 499 28 Optimizing and Tuning MySQL 515 29 Software Upgrades 533 Part VII: Looking Toward the Future CHAPTER 30 Features and Backwards-Compatibility of PHP 5.0 541 31 Features and Backwards-Compatibility of MySQL 4.1 547 Part VIII: Appendix APPENDIX A Installing MySQL, Apache, and PHP from the CD-ROM 557 Index 569 Table of Contents Introduction Who Should Read This Book? How This Book Is Organized Conventions Used in This Book Part I: Laying the Groundwork CHAPTER 1: Installing and Configuring MySQL Current and Future Versions of MySQL How to Get MySQL Installing MySQL on Linux/Unix Installing MySQL on Windows 16 16 17 Troubleshooting Your Installation Basic Security Guidelines Starting MySQL Securing Your MySQL Connection Introducing the MySQL Privilege System 18 19 20 21 The Two-Step Authentication Process Working with User Privileges Adding Users 18 Removing Privileges 23 23 25 Summary Q&A Workshop 25 Quiz 25 Answers 25 Activities 26 vi Sams Teach Yourself PHP, MySQL and Apache All in One CHAPTER 2: Installing and Configuring Apache 27 Current and Future Versions of Apache 27 Choosing an Installation Method 28 Building from Source 28 Installing a Binary 28 Installing Apache on Linux/Unix 29 Downloading the Apache Source Code 29 Uncompressing the Source Code 29 Preparing to Build Apache 30 31 32 Building and Installing Apache Installing Apache on Windows Apache Configuration File Structure 35 Directives 35 Containers 37 Conditional Evaluation 38 ServerRoot 39 40 41 41 41 Per-Directory Configuration Files Apache Log Files access_log error_log Additional Files 42 Apache-Related Commands 42 Apache Server Binary 42 Apache Control Script Starting Apache for the First Time Check Your Configuration File 43 44 44 Starting Apache 45 Troubleshooting 46 Already an Existing Web Server 46 No Permission to Bind to Port 46 Access Denied 47 47 Wrong Group Settings Summary 46 Contents Q&A 48 Workshop 48 Quiz 48 Answers 49 Activities CHAPTER 3: Installing and Configuring PHP 49 51 Current and Future Versions of PHP 51 Building PHP on Linux/Unix with Apache 52 Additional Configuration Options 54 55 Integrating PHP with Apache on Linux/Unix Installing PHP Files on Windows 53 Integrating PHP with Apache on Windows 55 php.ini Basics Testing Your Installation 56 57 Getting Installation Help 58 The Basics of PHP Scripts 60 62 63 Beginning and Ending a Block of PHP Statements The echo Statement and print() Function Combining HTML and PHP 59 Adding Comments to PHP Code 64 65 66 Summary Q&A Workshop 66 Quiz 66 Answers 67 Activities 67 Part II: PHP Language Structure CHAPTER 4: The Building Blocks of PHP 71 Variables 71 Globals and Superglobals 73 vii viii Sams Teach Yourself PHP, MySQL and Apache All in One Data Types 74 Changing Type with settype() 76 Changing Type by Casting 77 Why Test Type? 79 Operators and Expressions 79 The Assignment Operator 80 Arithmetic Operators 81 The Concatenation Operator 81 Combined Assignment Operators 82 Automatically Incrementing and Decrementing an Integer Variable 83 Comparison Operators 84 Creating More Complex Test Expressions with the Logical Operators 85 86 87 Operator Precedence Constants 89 89 90 Predefined Constants Summary Q&A Workshop 90 Quiz 90 Answers 91 Activities CHAPTER 5: Flow Control Functions in PHP 92 93 Switching Flow 93 The if Statement Using the else Clause with the if Statement 94 95 Using the else if Clause with the if Statement 96 The switch Statement 97 Using the ? Operator 99 Contents Loops 100 The while Statement 100 The while Statement 101 The for Statement 102 Breaking Out of Loops with the break Statement 104 Skipping an Iteration with the continue Statement 106 Nesting Loops Code Blocks and Browser Output 107 109 Summary 110 Q&A 112 Workshop 112 Quiz 112 Answers 113 Activity CHAPTER 6: Working with Functions 113 115 What Is a Function? 115 Calling Functions 116 Defining a Function 117 Returning Values from User-Defined Functions 120 Variable Scope 121 Accessing Variables with the global Statement 124 126 Saving State Between Function Calls with the static Statement More About Arguments 122 Setting Default Values for Arguments 127 128 130 Passing Variable References to Functions Testing for the Existence of a Function Summary 132 Q&A 133 Workshop 133 Quiz 133 Answers 134 Activity 134 ix 602 PHP 5.0 destructor() method, 543 ports error handling, 543 bind to port, troubleshooting, 46 object overloading, 543 TCP/IP Transport layer, 310-312 private and protected variables and methods, 542 position functions, 300 SQLite, 544 positive terms, 57 XML support, 544 POST method, 182 well-known ports, 310-312 when to upgrade, 545 $_POST superglobal, 73 PHP Announcements list, 533 $_POST value, 338-339 PHP distribution, image creation, 246 post-decrement operators, 83-84 PHP mailing lists, 58 post-increment operators, 83-84 PHP Manual Web site, 321, 331 posts PHP Web site, 52, 55, 58 adding to topics, 382-384 php.ini file, 53, 55-57 defined, 371 php.ini-dist file, 55 displaying in topics, 379-381 phpinfo() function, 57 pound sign (#), 36, 54 phpinfo.php file, 57 precedence (operators), 86-87 phpMyAdmin interface, 18 precision specifications (strings), 158-159 pid file, 42 predefined constants, 89 pie charts, creating, 251-254 preventing abuse (performance), 489 pipes, opening to and from processes, 237-239 print() function, 62, 116 plaintext message encryption, 500 printBR() function, 119 plus sign (+) (addition operator), 81 printf() function, 154-157 PNG libraries, image creation, 247 printing, cookies, 440 polygons privileges ImageFilledPolygon() function, 250 authentication process, 19-20 ImagePolygon() function, 248 columns priv table, 19 popen() function db table, 19 opening pipes to and from processes, 237 func table, 19 opening to and from processes, 239 granting, 21-23 passing data, 238-239 host table, 19 reading output, 238 overview, 18-19 port connections variable, 528 revoking, 23 port values (Listen directive), 44 tables priv table, 19 user table, 19 REPLACE() function PROCESS command, 21 readdir() function, 232-233 processes reading external processes, 483 directory contents, 232-233 server processes, 482 files processing arbitrary data amounts, 225-227 configuration files, MPMs, 39 characters, 227-228, 233 directives, 38 lines, 224-225 per-directory configuration files, 40 programs using popen() function, 237-239 README file, errors, logging, 456 recording events, error log, 41 HTTP requests, logging, 455 records rotating (Unix), 458 address book database table example properties, objects, 142-143 record addition script, 351-355 protocols, SSL, 500-505 records, adding subentries to, 362-367 ps command, 17 records, deleting, 361-362 public key cryptography, 501 records, selecting and viewing, 355-360 records, selecting and viewing, 355 queries inserting, 325-326 executing, 323-324 optimizing, 520-521 query strings, 209-210 quotation marks (“), 76 rectangles ImageFilledRectangle() function, 250 ImageRectangle() function, 248 reducing transmitted data (performance), 488 reference passing (arguments), 128 REFERENCES command, 22 registering multiple session variables, 208 R relationships, 262 r (read) mode, 223 many-to-many, 265-266 r format code (date() function), 175 one-to-many, 264 RAM disks, 484 one-to-one, 263 rand switch, 508 RELOAD command, 22 raw headers, 191 removing privileges, 23 RC2, 501 REPEAT() function, 302 RC4, 501 REPLACE command, 292-293 read mode, 223 REPLACE() function, 302 How can we make this index more useful? Email us at indexes@samspublishing.com 603 604 replacing replacing RPAD() function, 299 string portions, 168 RSA, 501 substrings, 168-169 RTRIM() function, 298-299 Reply-to header, 195 running commands request headers, 492 with exec() function, 239-240 request logs, creating, 449 with passthru() function, 241 $_REQUEST superglobal, 73 with system() function, 241-242 requests (client), tracking, 41, 449 Require directive, 429 require() function, 218 require_once() function, 218 S reset() function, 139 s format code (date() function), 175 resolving hostnames (managing logs), 457 s type specifier, 155 resource data type, 75 Satisfy All directive, 436 restricting access, 433-436 Satisfy Any directive, 436 authentication, 427 Satisfy directive, 436 authentication modules, 430-433 saving based on cookie values, 441-445 client authentication, 429 function state between calls, 124-126 state, hidden fields, 189-190 return statements, 120-121 scalability, 481-485 reverse DNS lookups, 452 ScanErrLog, 460 REVOKE command, 23-25 schemas, directives, 36 RGB color values, image creation, 245-246 scoreboard files, 42, 484 RIGHT JOIN command, 289 ScoreBoardFile directive, 484 RIGHT() function, 301 screen savers, 18 RLimitCPU directive, 483 Script tags, 61 RLimitMem directive, 483 ScriptAlias directive (mass virtual hosting), 494 RLimitNProc directive, 483 scripts rmdir() function, 231 apachectl, 38 robots.txt file, 490 configure, 52-53 root users, 17, 25 configure script, 30 rotatelogs program, 458 configure scripts, 30 rotatelogs utility, 455 control, 43 rotatelogs.exe program, 458 file upload, 199-200 rotating logs, 458 PHP, 59-60 splitting, 459 session_start() function SEC_TO_TIME() function, 315 SECOND() function, 308-309 self-signed certificates (managing certificates), 510 second normal forms, 268-269 semicolons (;), 6, 44, 72, 101 sections, 37 See also containers sending secure HTTP, 500 secure servers certificates, managing, 508-510 mail, 342-344 on form submission, 192-197 signals, kill command, 42 communications, 499 serialize() function, 207 SSL, configuring, 511 server binary, commands, 42 SSL protocols, 500-505 server environment Secure Sockets Layer (SSL), 500 commands running with exec() function, 239-240 security access control, 437 basic authentication, 428 communications authentication, 500 confidentiality, 499 integrity, 499 digest authentication, 428 lock screen mechanism, 18 MySQL connections, securing, 18 server startup procedures, 17 reverse DNS lookups, 452 SSH, 18 symbolic links (symlinks), 484 security issues, software upgrades, 534 SELECT command, 20-22, 280-281, 285-287 SELECT statement, 183, 325 selecting installation methods, 28 running with passthru() function, 241 running with system() function, 241-242 pipes, opening to and from processes, 237-239 server headers, 190 server processes, 482 $_SERVER superglobal, 73 ServerAlias directive (syntax), 493 ServerName directive, 36, 44 ServerRoot directive, 39 servers loads, distributing (performance), 488 MySQL, shutting down, 15 starting (SSL configurations), 511 virtual servers, specifying ( directive container), 37 Web servers, Apache installations (Windows), 32 servers, 499 See also secure servers troubleshooting, 46 binaries (installing), 28 Service icon, 43 source code(building), 28 session IDs, 209-210 variable names, 72 session_set_save_handler() function, 203 session_start() function, 401 How can we make this index more useful? Email us at indexes@samspublishing.com 605 606 session variables session variables, 205-209 sessions field names, 399-401 integrating with storefront, 401-403 destroying, 210-211 short open tag switch, 61 overview, 203 short tags, 61 session_set_save_handler() function, 203 SHOW COLUMNS command, 525 starting, 204-205 SHOW command, 522 session_destroy() function, 210-211 SHOW CREATE TABLE command, 524-525 session_id() function, 204 SHOW DATABASES command, 523 session_save_path() function, 206 SHOW GRANTS command, 522-523 session_start() function, 204-205 SHOW INDEX command, 525 $_SESSION superglobal, 73, 205-207 SHOW OPEN TABLES command, 524 set_time_limit() function, 344 SHOW STATUS command, 518, 527 Set-Cookie header, 439 SHOW TABLE STATUS command, 526-527 setcookie() function, 440-441 SHOW TABLES command, 524 setDate array() function, 421-422 SHOW VARIABLES command, 14, 527-528 setDate global() function, 422-423 shuffle() function, 140 settings SHUTDOWN command, 22 group settings, troubleshooting, 47 shutting down MySQL server, 15 network settings, 485, 489 signed data types, 274 scalability, 483-485 single quotation marks (‘), 76 status settings, 485 single-byte character sets, 468 settype() function, 76-77 single-line comments, 65 setup.exe application, size attribute, 128 setup.exe file, 10 size (file), 219 setYearEnd() function, 422 sizeof() function, 139 setYearStart() function, 422 skipping iterations (loops), 106-107 SHA, digest algorithms, 502 slash (/) (division operator), 81 shapes, drawing, 248-249 slow queries status variable, 527 shopping cart database table example SMALLINT data type, 274 cart, adding items to, 404-405 software, configuring (Apache installations), 30 cart, removing items from, 408-409 software load balancer (performance), 487 cart, viewing, 405-407 software upgrades checkout actions, performing, 410-411 Apache, 535-536 checkout form, creating, 409-410 Apache News and Announcements list, 533 field lengths, 399 MySQL, 535 statements MySQL Announcements list, 533 SSLCertificateFile directive, 511 PHP, 536-537, 545 SSLeay library, 505 PHP Announcements list, 533 stacking images, 256-257 staying current, 533 standard tags, 61 when to upgrade, 534-535 Start Apache link, 45 Solaris Start menu commands, Control Apache, 45 file descriptors, 483 start tags, 61-62, 66 server processes, 482 $start variable, 418 source code starting building, installation methods (selecting), 28 Apache, 43-45 downloading (Apache installations), 29 Apache (manually), 34 uncompressing (Apache installations), 29 block of statements, 61-62 spaces (HTML documents), viewing, 157 MySQL, 17 specifiers (strings), 159-160 servers (SSL configurations), 511 specifying virtual servers ( directive container), 37 sessions, 204-205 split-file Perl script, 459 splitting logs, 459 sprintf() function, 162, 424 startup, MySQL, 517 key buffer size parameter, 518-519 table cache parameter, 518-519 state SQLite database engine (new feature), 544 functions, saving between calls, 124-126 SSH, 18 saving hidden fields, 189-190 SSL statements See also commands configuring (secure servers), 511 block of, starting/ending, 61-62 digital certificates, 504 break installing, 507 mod_ssl module, 506-507 OpenSSL library, 505 protocols code ends, 98 loops, 104-106 continue, 106-107 control, code block brackets, 112 authentication, 503-505 defined, 63 authentication (connections), 504-505 DELETE, 325 confidentiality, 500-502 do, while, 101-102 confidentiality (public key cryptography), 501 exit, 191 encryption, 500 SSL (Secure Sockets Layer), 500 SSL protocols, 501 for, 102-104 foreach, 200 function, 117-119 How can we make this index more useful? Email us at indexes@samspublishing.com 607 608 statements function state, saving, 124-126 storefront database table example global, 122-125 add to cart button, 395-397 if, 84, 94, 418 categories of items, displaying, 392-394 else clause with, 95-96 planning process, 387-388 elseif clause with, 96-97 store categories field, 388-389 example of, 94 store item color field, 388-391 INSERT, 325 loops See loops return, function values, 120-121 store item size field, 388, 391 store items field, 388-390 storing SELECT, 183, 325 certificate signing requests, 510 static, 126 client authentication, 429 switch, 97-99 formatted strings, 162 UPDATE, 325 password files (file-based authentication), 431 while, 84, 100-101 static statement STRAIGHT JOIN command, 289 function state, saving, 124-126 string data type, 74, 76 remembering function variable values between calls, 126 string data types, 276-277 status strings breaking into arrays, 172 files, checking, 219 case, converting, 169 schemas, directives, 37 cleaning up, 166-167 status code, conditional logging, 453 defined, 62 status settings, scalability, 485 formatted, storing, 162 stopping formatting, 154 Apache, 43 example, 159-160 MySQL server, 15 field width specifications, 157-158 storage, back-end storage, 430-432 padding specifiers, 156-157 store categories field, storefront database table example, 388-389 precision specifications, 158-159 store item color field, storefront database table example, 388-391 specifiers, 159-160 store item size field, storefront database table example, 388-391 store items field, storefront database table example, 388-390 printf() function, 154 type specifiers, 155-156 indexing, 162 length, finding, 163 log formats, 450 modification functions, 301-302 table relationships portions, extracting, 164 superglobals, 73 portions, replacing, 168 $_FILES, 197 query, session IDs, passing, 209-210 $_SESSION, 205-207 substrings support contracts, MySQL, 16 finding, 163 support-files subdirectories, 517 position, finding, 163-164 switch statements, 97-99 replacing, 168-169 switches tokenizing, 165-166 -DMyModule, 38 wrapping text, 170-171 rand, key pairs stripslashes() function, 378-381, 384 creating (certificates), 508 strlen() function, 163 symbolic links (symlink), 484 strpos() function, 163-164 symlink (system links), 484 strstr() function, 163 SymLinksIfOwnerMatch parameter, 484 strtok() function, 165-166 symmetric cryptography, 501 strtolower() function, 169 syntax strtoupper() function, 169 container directives, 38 str_replace() function, 168-169 error log, 41 subdirectories, 56, 517 See also directories conditional container, 39 subexpressions, 80 conditional container, 39 subqueries (MySQL) overview, 547-548 per-directory configuration files, disabling, 41 time tracking example of, 548-550 request headers, 492 schemas, 36 subscription project, 335 ServerAlias directive, 493 mail, sending, 342-344 subscribe and unsubscribe requests, 336-342 syslog daemon, 455 subscribers table, creating, 336 system() function, 241-242 syslog daemon argument, 456 substr() function, 164 SUBSTRING() function, 300-301 substrings finding, 163 T position, finding, 163-164 table cache parameter, 518-519 replacing, 168-169 table relationships, 262 substr_replace() function, 168 many-to-many, 265-266 subtraction operator (-), 81 one-to-many, 264 one-to-one, 263 How can we make this index more useful? Email us at indexes@samspublishing.com 609 610 table type variable table type variable, 528 discussion forums, 371-372 tables FLUSH TABLES command, 521 address book database table example, 347 func, 19 date added field, 348 host, 19 date modified field, 348 OPTIMIZE TABLE command, 519 menus, creating, 350 shopping cart database table example record addition script, 351-355 cart, adding items to, 404-405 records, adding subentries to, 362-367 cart, removing items from, 408-409 records, deleting, 361-362 cart, viewing, 405-407 records, selecting and viewing, 355-360 checkout actions, performing, 410-411 table name fields, 348-350 checkout form, creating, 409-410 auth users, 442 field lengths, 399 calendar example, 416, 418-419 field names, 399-401 columns priv, 19 creating, 323-324 integrating with storefront, 401-403 SHOW COLUMNS, 525 CREATE TABLE command, 277-278 SHOW CREATE TABLE, 525 CROSS JOIN command, 289 SHOW CREATE TABLE command, 524 DELETE command, 294-295 SHOW INDEX, 525 INNER JOIN command, 287 SHOW OPEN TABLES command, 524 INSERT command, 278-280 SHOW STATUS, 527 JOIN command, 287 SHOW TABLE STATUS, 526-527 LEFT JOIN command, 288 SHOW TABLES command, 524 LIKE operator, 284 SHOW VARIABLES, 527-528 LIMIT command, 282-283 storefront database table example NATURAL JOIN command, 289 add to cart button, 395-397 REPLACE command, 292-293 categories of items, displaying, 392-394 RIGHT JOIN command, 289 planning process, 387-388 SELECT command, 280-281, 285-287 store categories field, 388-389 STRAIGHT JOIN command, 289 store item color field, 388-391 UPDATE command, 289-292 store item size field, 388-391 WHERE clause, 283 store items field, 388-390 custom logs, 460 code snippet, 460-461 sample reports, 461-464 db, 19 tables priv, 19 user, 19 tables priv table, 19 timestamps tags table, creating, 416-419 ASP, 61 user input, 413-414 end tags, 66 calendar example, 414 script, 61 CURRENT_TIME() function, 314 short, 61 CURRENT_TIMESTAMP() function, 314 short open tag switch, 61 current, retrieving, 172-173 standard, 61 CURTIME() function, 314 start tags, 66 formatting, 174-176 start/end, 61-62 FROM_UNIXTIME() function, 314 tagWrap() function, 131 HH-MM-SS format, 314 tail command-line utility, 459 HOUR() function, 308-309 tar command, 9, 29 information, retrieving, 173 tarball, 29 MINUTE() function, 308-309 targets, 30 NOW() function, 313 TCP/IP, 310-312 SEC_TO_TIME() function, 315 TCP/IP protocol system, 310-312 SECOND() function, 308-309 ternary operator (?), 99-100 TIME_FORMAT() function, 311 test expressions, 112 TIME_TO_SEC() function, 315 test() function, 121 UNIX_TIMESTAMP() function, 314 testing TIME data type, 276 data types, 75 time data types, 275-276 dates, 178 TIME_FORMAT() function, 311 functions, existence, 130-132 time stamps PHP installation, 57 text wrapping, 170-171 TEXT data type, 276 text editors, 44 converting date(), 174-176 getdate(), 173 creating, 176 TEXT field, 16 TIME_TO_SEC() function, 315 Thawte, CA (certification authority), 510 time tracking subquery example, 548-550 Thawte Web site, 510 time() function, 172-173, 440 third normal forms, 267-269 TimeOut directive, 489 time timestamp, 172 calendar, 413 HTML form, 414-416 library, creating, 420-425 TIMESTAMP data type, 275 timestamps converting, 174-176 creating, 177 How can we make this index more useful? Email us at indexes@samspublishing.com 611 612 TINYBLOB data type TINYBLOB data type, 276 MySQL installation, 16 TINYINT data type, 274 MySQL upgrades, 535 TINYTEXT data type, 276 servers, starting (SSL configurations), 511 TITLE element, 415 Web servers (existing), 46 TLS (Transport layer security), 500 See also SSL $_txt variable, 119 tokenizing strings, 165-166 TYPE argument, 198 tools type specifiers, strings, 155-156 apachectl, 43 types See data types command-line, 508 typical installation, Apache (Windows), 34 performance, 485 Typical installation option, 11 topics adding, 372-375 adding posts to, 382-384 defined, 371 U displaying posts in, 379-381 U format code (date() function), 175 topic list, displaying, 375-378 UCASE() function, 301 touch() function, 222 ucwords() function, 169-170 tracking ulimit command, 482 client requests, 41 clients, 454 uncompressing source code (Apache installations), 29 TransferLog directive, 454-455 underline() function, 131 transmitted data, 488 underscore (_), 72 transparent images, 256-257 uninitialized variables, 75 Transport layer (TCP/IP protocol), 310-312 Unix Transport layer security (TLS), 500 See also SSL TRIM() function, 298 trim() function, 166-167 Apache installing (source), 29 starting, 45 trimming functions, 298-299 apachectl tool, 43 Triple-Des, symmetric cryptography, 501 installing Apache, 29 troubleshooting, 46 installing MySQL on, 8-9 bind to port, 46 installing PHP on, with Apache, 52-53 clients, tracking, 454 integrating PHP with Apache on, 54 denied access, 46 logging errors, 455 group settings, 47 OpenSSL library, installing, 506 var keyword resolving, 457 user table, 19 rotatelogs programs, 458 User-Agent header, 435 Unix epoch, 172 user-created functions, 19 UNIX_TIMESTAMP() function, 314 user-defined functions, 117 unlink() function, 222 unsigned data types, 274 values, returning, 120-121 usernames unsubscribe requests, 336-340, 342 basic authentication, 428 unzipper, 55 UPDATE command, 22, 289-292 client authentication, 429 users UPDATE statement, 325 adding, 21-23, 433 upgrades deleting, 433 Apache, 535-536 lists, Require directive, 429 Apache News and Announcements list, 533 management, client authentication, 429 MySQL, 535 ownership, verifying, 17 MySQL Announcements list, 533 redirecting (forms), 190 PHP, 536-537, 545 root, 17 PHP Announcements list, 533 non root users, 17 staying current, 533 running MySQL as, stopping, 25 when to upgrade, 534-535 root users uptime status variable, 527 MySQL running as, 17 URLs, directives, applying, 38 users file, 430 USAGE command, 22 USR1, 43 user input utilities, 29, 431, 455-457 calendar example, 413-414 HTML forms accessing from multiple SELECT elements, 183-186 receiving, 181-182 user login form, 443-445 user management V -v, httpd option, server binary, 42 value directives, 56 values database file-based access control authentication, 432-433 directives, 40 functions, authentication modules, 430 functions, returning, 120-121 user management, file-based authentication, 431 port values (Listen directive), 44 var keyword, object properties, 142 How can we make this index more useful? Email us at indexes@samspublishing.com 613 614 VARCHAR data type VARCHAR data type, 276 integers, incrementing/decrementing, 83 VARCHAR field, 16 $name, 420-421 variables names, 74 availability rules, 73 names of, selection considerations, 72 casting, 77-79 $newnum, 117 $count, 418 session, 205-209 data types, 74 $start, 418 array, 74 superglobals, 73 boolean, 74 $tst, 119 changing, 76-79 uninitialized, 75 double, 74 values given to, overview, 72 integer, 74-76 NULL, 75 values, remembering between calls, 124-126 object, 74 when to use, 72 resource, 75 $name, 421 special, 75 DISTINCT, 306 string, 74-76 VeriSign, CA (certificate authority), 510 testing, 75 VeriSign Web site, 510 $dayArray, 418 version changes, upgrades, 534 declaring, 72 version type variable, 528 defined, 71 viewing environment variables access control rules, 435 conditional looping, 453 CustomLog directive, 454 $file array, 200 $file dir, 199 $file name, 200 $firstDayArray, 419 functions accessing, 122-124 scope, 121 global file upload, 197 globals, 73 directory contents, 232-233 spaces, HTML documents, 157 virtual hosting, 490 DNS (domain name server), 490 mass virtual hosting, 493 virtual servers, specifying ( directive container), 37 VirtualDocumentRoot directive (mass virtual hosting), 494 VirtualDocumentRootIP directive (mass virtual hosting), 495 VirtualScriptAlias directive (mass virtual hosting), 494 VirtualScriptAliasIP directive (mass virtual hosting), 495 < (less than) operator virtual hosting well-known ports, 310, 312 DocumentRoot, 491 WHERE clause, 283-284, 305, 336 IP-based, 491 while statements, 84, 100-101 name-based, 491-493 whitespace, 57 VirtualHost containers, 491 width, field width specification, 157-158 wildcards %, 22 W-X-Y-Z w (write) mode, 223 warn, LogLevel directive option, 457 *, 22 WINCH, signals, sending, 43 Windows Apache Web crawlers, 489 controlling (commands), 43 Web page structure, application localization, 471-476 starting, 45 errors, logging, 455 Web servers installing Apache, 34 Apache, installing (Windows), 32 installing Apache on, 32-35 troubleshooting, 46 installing MySQL on, 9-11 Web sites installing PHP on, 55 Apache, 29 integrating PHP with Apache on, 55-56 awstats, 459 OpenSSL library, installing, 506 hosting See virtual hosting rotatelogs.exe programs, logs (rotating), 458 Logscan, 460 winmysqladmin.exe application, 14 MySQL, wizards (MySQL installation), 10-11 MySQL Manual, 551 wordwrap() function, 170-171 performance tools, 485 wrapping text, 170-171 PHP, 52, 55, 58 write (w) mode, 223 PHP Manual, 321, 331 writing to files, 228-229 ScanErrLog, 460 WS-FTP for Windows, 60 Thawte, 510 X type specifier, 155 VeriSign, 510 X.509, digital certificates, 504 Webalizer, 459 xor operator, 85 Web spiders, abuse, preventing, 489 >= (greater than or equal to) operator, 84 Webalizer, log analysis, 459

Ngày đăng: 08/11/2019, 11:09