Cover image for Apache, MySQL, and PHP Web development : all-in-one desk reference for dummies
Title:
Apache, MySQL, and PHP Web development : all-in-one desk reference for dummies
Personal Author:
Publication Information:
Indianapolis, Ind. : Wiley Publishing, 2004
ISBN:
9780764549694

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010068026 QA76.73.S67 C63 2004 Open Access Book Book
Searching...

On Order

Summary

Summary

* Covers the entire open source Web platform known as LAMP, which includes Linux, Apache, MySQL, and PHP, the basis for many dynamic data-driven Web sites
* Seven convenient minibooks provide easy reference on open source and team development, working with Linux and Apache, automating Web sites with Perl, developing front-end applications with Tcl/TK, creating dynamic Web pages with PHP, accessing Web databases with MySQL, and processing Web files with regular expressions
* Includes valuable, hard-to-find coverage of collaboration, file sharing, and version control with CVS
* PHP is running on over nine million sites, with an average increase of 6.5 percent monthly over the past two years; Apache Web servers handle seventy percent of Web content


Author Notes

Jeff Cogswell, is a software engineer, writer, consultant, and educator


Table of Contents

Introductionp. 1
About This Bookp. 1
Foolish Assumptionsp. 2
Conventions Used in This Bookp. 3
How This Book Is Organizedp. 3
Book I Configuring Linux and Windows for Apachep. 3
Book II Building an Apache Web Sitep. 3
Book III Perl Web Site Automationp. 4
Book IV Tcl/Tk Front End Developmentp. 4
Book V PHP Web Pages for Dynamic Contentp. 4
Book VI MySQL Databases on the Webp. 4
Book VII Processing Web Files with Regular Expressionsp. 5
Book VIII Appendixesp. 5
Icons Used in This Bookp. 5
Getting Startedp. 6
Book I Configuring Linux and Windows for Apachep. 7
Chapter 1 Configuring Linuxp. 9
Getting a Handle on TCP and UDP Servicesp. 10
No Sharing: NFS/RPCp. 14
Misleading Binaries (SUID/GUID Binaries)p. 15
Protection with Firewallsp. 16
Playing Games: IP Masqueradep. 19
Keeping on Top with Loggingp. 20
Chapter 2 Configuring Windowsp. 23
Securing Windows during Setupp. 23
Keeping Up with Patches and Updatesp. 29
Analyzing with MBSAp. 30
Getting Windows behind a Firewallp. 31
Chapter 3 Ten Third-Party Packages That Enhance Securityp. 33
Locking Down with Bastillep. 33
Linux Intrusion Detection with LIDSp. 34
Starting Easy with Guarddogp. 34
Taking Control with Firestarterp. 35
WinRoute Firewallp. 36
ZoneAlarmp. 37
Snortp. 37
ACIDp. 38
Opening the Box: Pandorap. 38
Getting In with Nessusp. 39
Book II Building an Apache Web Sitep. 41
Chapter 1 Introducing the Apache Web Serverp. 43
The Advantages to Using the Apache Web Serverp. 43
Understanding How Apache Worksp. 44
Taking a Look at the Apache Architecturep. 49
Chapter 2 Installing Apachep. 51
Getting Apache from the Webp. 51
Installing Apache from Source Filesp. 53
Installing Apache from Binariesp. 56
Installation Optionsp. 58
Starting and Stopping Apachep. 61
Troubleshooting Apachep. 64
Running Multiple Apache Serversp. 66
Chapter 3 Configuring Apachep. 67
Understanding Configuration Filesp. 67
Using Directivesp. 69
Running Scriptsp. 77
Configuring Directories and Filesp. 79
Configuring Virtual Hostsp. 84
Chapter 4 Apache Modulesp. 87
Installing Modulesp. 87
Some Useful Modulesp. 89
Chapter 5 Ten Security Tipsp. 93
Update Regularlyp. 93
Restrict Access to the Apache Directoryp. 93
Don't Run Your Server as Rootp. 93
Monitor Server Requestsp. 94
Use a Restricted Default Directoryp. 94
Don't Let Users See Your Filesp. 94
Limit CGI Scriptsp. 94
Don't Allow .htaccess Filesp. 94
Use suEXEC Carefullyp. 95
Use SSL for Important Communicationsp. 95
Book III Perl Web Site Automationp. 97
Chapter 1 Introducing Perlp. 99
Trying Out a Simple Perl Programp. 99
Processing Text Filesp. 103
Running as a CGI scriptp. 104
Interacting with Web Serversp. 105
Navigating the Perl Online Helpp. 105
Chapter 2 Simple Data Typesp. 107
Storing Data in Variablesp. 108
Storing Single Items as Scalarsp. 109
Storing Lists of Itemsp. 115
Associating Data with Hashesp. 121
Understanding Scalar Context and List Contextp. 122
Chapter 3 Comparing and Testing Variablesp. 125
Testing Conditionsp. 125
Performing Actions Based on Conditionsp. 129
Making Consecutive Comparisonsp. 130
Comparing in Different Waysp. 133
Performing Comparisons Togetherp. 136
Chapter 4 Controlling the Structure of Your Programp. 137
Loopingp. 138
Subroutinesp. 148
Chapter 5 Processing Text Files and Directoriesp. 157
Processing Directoriesp. 158
Processing Filesp. 161
Chapter 6 Advanced Perl Codingp. 169
Accessing Data through Referencesp. 169
Building Objectsp. 174
Manipulating Dates and Timesp. 183
Chapter 7 Perl and CGI Scriptsp. 191
Configuring Apache for CGIp. 192
Writing a Simple CGI Scriptp. 195
Reading Information Passed to the CGI Scriptp. 197
Writing CGI Scripts with CGI.pmp. 200
Displaying Errors and Warningsp. 204
Chapter 8 Ten Useful Perl Functionsp. 207
Sorting an Arrayp. 207
Reversing an Arrayp. 208
Obtaining the Length of an Arrayp. 209
Treating an Array as a Stack Structurep. 209
Treating an Array as a Queue Structurep. 210
Converting Hex to Decimalp. 212
Obtaining a Random Numberp. 213
Searching and Replace Substringsp. 214
Converting a String to Uppercase or Lowercasep. 215
Book IV Tcl/Tk Front End Developmentp. 217
Chapter 1 What Are Tcl and Tk?p. 219
Trying Out Tclp. 219
Creating a Simple Tcl Programp. 223
Chapter 2 Processing Variables and Expressionsp. 227
Evaluating Expressionsp. 227
Processing Stringsp. 232
Storing and Manipulating Lists of Datap. 243
Chapter 3 Controlling the Structurep. 249
Choosing Conditionsp. 249
Looping with Various Commandsp. 259
Chapter 4 Building Proceduresp. 265
Creating a Simple Procedurep. 265
Passing Parameters to a Procedurep. 266
Returning a Value from a Procedurep. 268
Passing Multiple Parametersp. 270
Chapter 5 Manipulating Filesp. 273
Creating a New File and Writing to Itp. 273
Opening a File and Reading from Itp. 274
Appending to an Existing Filep. 276
Finding Out Information about a Filep. 277
Managing Files and Directoriesp. 278
Creating File Linksp. 280
Chapter 6 Programming with the Tcl Packagesp. 283
Accessing Files on the Webp. 283
Manipulating Textp. 284
Building Advanced Data Structuresp. 286
Chapter 7 Designing GUIs with Tkp. 291
A Hierarchy of Widgets and Namesp. 292
Creating a Simple Windowp. 294
Adding a Button to a Windowp. 295
Creating a Listbox (And More on the Pack and Bind Commands)p. 297
Creating a Second Windowp. 300
Adding a Menu Bar to a Windowp. 301
Attaching a Menu to a Buttonp. 302
Sliding Across the Numbers with a Scalep. 304
Changing a Control Such As a Label's Textp. 306
Chapter 8 Arranging Controls, Drawing Pictures, and Handling Textp. 309
Arranging Controls with Geometry Managersp. 309
Drawing on a Canvasp. 317
Processing Text with a Text Widgetp. 325
Chapter 9 Displaying Standard Dialog Boxes in Tkp. 333
Getting Input from a Message Boxp. 333
Selecting a Directoryp. 335
Choosing a File to Openp. 336
Picking a Filename to Savep. 337
Grabbing a Colorp. 338
Making a Lifesaving Decision (Or Just Getting Information)p. 339
Chapter 10 Ten Useful Tcl/Tk Toolsp. 341
Tk GUI Designersp. 341
Developer Toolsp. 343
Book V PHP Web Pages for Dynamic Contentp. 345
Chapter 1 What You Can Do with PHPp. 347
Introducing PHP Function Librariesp. 348
Adding Dynamic Contentp. 349
Running Types of Applicationsp. 351
Chapter 2 Writing Server-Side Scriptsp. 353
Exploring the PHP Processorp. 355
Starting and Ending PHP Codep. 357
Using Appropriate Filename Extensionsp. 358
Converting PHP to HTMLp. 359
Dealing with Errors in Your PHP Codep. 365
Exploring Some PHP Ground Rulesp. 365
Getting Help with PHPp. 366
Chapter 3 Storing Informationp. 367
Naming Variablesp. 367
Storing Information in Variablesp. 368
Understanding Data Typesp. 369
Determining Whether a Variable Existsp. 371
Removing Variablesp. 371
Expressing Your Variables and Other Expressionsp. 372
Stringing Up Characters with Stringsp. 377
Chapter 4 Controlling the Program Flowp. 385
Comparing with if Statementsp. 385
Looping with whilep. 388
Doing for Loopsp. 390
Comparing with switch Statementsp. 393
Breaking and Continuing Your Loopsp. 397
Building HTML Tables with Loopsp. 398
Chapter 5 Arrays and Functionsp. 401
Gathering Data into Arraysp. 401
Calling Code with Functionsp. 412
Chapter 6 Interacting with HTMLp. 417
Getting Data from an HTML Formp. 417
Sending Headers and REdirecting HTML Pagesp. 425
Setting and Retrieving Cookiesp. 429
Providing User Authenticationp. 431
Chapter 7 Advanced Programming with PHPp. 435
Including and Requiring Other PHP Filesp. 435
Advanced Coding with Variablesp. 443
Processing Stringsp. 449
Chapter 8 Creating Graphicsp. 453
Creating Bars and Graphs without Using Extra Librariesp. 453
Creating Graphics Filesp. 456
Creating Thumbnail Imagesp. 462
Chapter 9 Modeling Data with Classesp. 465
Building Classesp. 465
Constructing and Destructing Objectsp. 467
Coding for Dynamic Bindingp. 469
Inheriting and Deriving Objectsp. 470
Getting Information on Classesp. 472
Chapter 10 Ten Ways to Enhance Your Web Sitep. 475
Redirect index.html to index.phpp. 475
Display the Current Timep. 476
Dynamically Generate Style Sheetsp. 477
Allow File Uploadsp. 478
Use POST When Appropriatep. 481
Randomly Generate Picture-of-the-Day Imagesp. 482
Write Text from a Filep. 482
Determine Which Browser Is Runningp. 483
Create a Random Linkp. 484
Determine Host Names from IP Addressesp. 485
Book VI MySQL Databases on the Webp. 487
Chapter 1 What Is MySQL?p. 489
Connecting MySQL and PHP on the Webp. 490
Starting MySQLp. 492
Adding MySQL Usersp. 495
Chapter 2 Managing Databases and Tablesp. 505
Managing a Databasep. 506
Managing Tablesp. 511
Chapter 3 Relating Your Datap. 519
Dividing Your Data into Tablesp. 519
Typing the Data in a Tablep. 528
Creating the Databases and Tablesp. 530
Chapter 4 Accessing MySQL from PHPp. 537
Connecting to MySQL from PHPp. 537
Adding MySQL Data with PHPp. 540
Displaying MySQL Data on a Web Pagep. 549
Chapter 5 Querying with SQL and PHPp. 553
Creating a Lookup Formp. 553
Modifying Data with a Web Pagep. 557
Chapter 6 Accessing MySQL from Perlp. 567
Obtaining the Perl DBI and MySQL Components on Windowsp. 567
Connecting to a Database and Performing a Simple Queryp. 569
Querying the Databasep. 570
Modifying the Databasep. 573
Chapter 7 Creating a Username System for Your Web Sitep. 577
Creating the Login Tablesp. 578
Building the Registration Systemp. 580
Designing a Login Formp. 583
Coding the Access Routines in a Single .php Filep. 586
Helping Users Who Forgot Their Passwordsp. 594
Chapter 8 Ten Ways to Enhance a Web Site with Databasesp. 599
Programming an Online User Pollp. 599
Adding a Hit Counterp. 600
Performing Advanced Queriesp. 600
Creating Databases That Support Transactionsp. 601
Building a Forum or Message Boardp. 602
Creating a Journal or Daily Notep. 603
Adding an Administrator-Only Sectionp. 603
Building a Distributed Databasep. 603
Tracking Scores for Gamesp. 604
Tracking Usage Informationp. 604
Book VII Processing Web Files with Regular Expressionsp. 607
Chapter 1 Why Use Regular Expressions?p. 609
Getting to Know Regular Expressionsp. 609
Trying Out Regexes in Tcl and PHPp. 621
Chapter 2 Following the Syntax of Regular Expressionsp. 623
Matching Multiple Characters Using Quantifiersp. 624
Matching Special Charactersp. 626
Chapter 3 Customizing, Searching, and Replacingp. 637
Preventing Extra Characters at the Beginning and Endp. 637
Customizing the Regex Engine While Matchingp. 640
Searching and Replacingp. 643
Chapter 4 Grouping and Capturingp. 649
Grouping with Alternative Wordsp. 649
Capturing Text from a Matchp. 651
Side Effects with Alternatives and Accidental Capturesp. 656
Chapter 5 Joining, Splitting, and Making Upp. 659
Splitting All Over the Placep. 660
Joining Together with the Bandp. 665
Chapter 6 Processing Multiple Lines and Filesp. 667
Processing Multiline Stringsp. 668
Searching for All Lines in a File That Contain a Patternp. 671
Modifying Multiple Newlinesp. 672
Chapter 7 Processing HTML Filesp. 677
Building a Form Based on a List of Stringsp. 677
Automatically Creating Size Information for IMG Tagsp. 679
Extracting All the HTML Textp. 682
Searching Only the Text Portion of an HTML Filep. 685
Chapter 8 Ten Regular Expression Gotchasp. 687
Trying to Cram Multiple Tasks into a Single Expressionp. 687
Accidentally Capturing Alternativesp. 688
Capturing Too Much Due to Greedinessp. 688
Doing a Search When You Mean to Replacep. 688
Writing Code That Accidentally Ignores the Backslashesp. 689
Attempting to Use a Feature That's Not Presentp. 689
Getting the Uppercase and Lowercase Wrongp. 689
Forgetting to Include the Delimiters (Especially in PHP)p. 690
Forgetting the Global Optionp. 690
Mixing Up Singleline, Multiline, and the Defaultp. 691
Book VIII Appendixesp. 693
Appendix A Managing Files with CVSp. 695
Taking a Closer Look at CVSp. 695
Getting CVSp. 696
Using CVSp. 697
Creating a CVS Repository and Projectp. 703
Browsing CVS Repositories from the Webp. 705
Appendix B Understanding Open-Source Licensesp. 707
What Is Open Source?p. 707
How Do People Make Money?p. 708
What Is an Open-Source License?p. 708
Indexp. 711