|
Using Open Source Web Software with Windows
Open Source is NOT JUST FOR LINUX/UNIX!Open source is changing the software market because of its advantages over commercial tools including cost savings, greater reliability, security, improved performance, and scalability. Although open source is primarily associated with Linux, many people, including IT professionals, don't realize that open source
programs can work on a standard Windows platform. In addition, most open source documentation is Linux/UNIX-focused, so instructions and examples are not easily accessible to Window users.Using Open Source Web Software with Windows addresses these issues by introducing Windows administrators, programmers, and Web developers to open source server tools such as Perl, MySQL, Apache, and PHP, which are currently used to power more than 65% of Web site worldwide. Users learn everything they need to implement these tools effectively, including the basics of downloading and installing each of the packages. From there they use the tools and programs in practical combinations to create a self-contained Web server on Windows. After working through the book, Windows users will be able to handle open source database methods, send pages to the Web or Intranets, and make dynamic Web databases. Using open source software will help to reduce licensing costs and improve the reliability, security, and efficiency of their Web tools.
CONTENTS:
Introduction xi
1 The Web Server Process 1
Server-Side Processes 3
Client-Side Processes 3
The Overall Process 4
Web Protocols 5
What Happens to the Request? 7
Summary 8
2 Installing Apache HTTP Server 9
History of Apache HTTP Server 10
Stopping Any IIS Sites 11
Obtaining Apache 13
Installing Apache 16
Running Apache 23
Checking the Server 25
Configuring the hosts File 26
Summary 29
3 Configuring Apache 31
Directories 32
The HTTPD.CONF Configuration 33
Directives 34
Virtual Hosts 34
Contents
v
Preventing Directory Listing 39
Using .htaccess Files to Secure a Directory 42
Using Server Side Includes 50
Adding Security with OpenSSL 54
Initial Steps 55
Creating a Test Certificate 56
Wrapping up SSL 58
Summary 61
4 Installing and Exploring Perl 63
The History of Perl 64
Installing ActiveState ActivePerl 64
Testing the Installation 70
Exploring Perl 71
The Shebang, Switches, and Content-Type Line 71
Literals and Scalar Variables 72
Print Statements and Quotation Marks 73
Checking Syntax 78
Operators 79
Collecting User Input with CGI.pm 83
Using Arrays 85
Using Hashes 88
Conditionals and Loops 89
Subroutines 97
Summary 100
5 Installing PHP 101
History of PHP 102
Installing PHP 103
Installing PHP as a CGI Executable 104
vi Contents
Installing PHP as a Module 105
Installing PHP with Internet Information Services 108
PHP 5 and MySQL 117
Summary 118
6 Exploring PHP 119
PHP Syntax 120
Using print() and echo 121
Using printf() and sprintf() 122
PHP Comments 123
Variables, Literals, and Constants 124
Operators and Expressions 128
Arithmetical Operators 128
String Operator 129
Assignment Operators 129
Unary Operators 130
Comparison Operators 130
Logical Operators 131
Operator Precedence 132
Arrays 133
Conditionals 136
Loops 138
Functions 140
Variable Scope 140
Includes 141
Working with Forms 142
Create a Form 142
Using GET and POST 144
Receiving Form Variables 145
Contents vii
Submitting Array Valuues from Forms 149
Self-Posting Forms 150
Creating a PHP Slideshow 158
Creating thumbnails.php 158
Creating index.php 160
Creating photo.php 162
Summary 166
7 PHP and the File System 167
Creating a Web Counter 168
PHP File Systems Functions 170
Revisiting the Counter 180
Working with Images in PHP 182
Enabling GD Support 182
Creating Shapes 182
Creating a Dynamic Poll 196
Generating E-Mail 204
Enabling SMTP 204
Creating an E-Mail Script 207
Summary 212
8 Introducing MySQL 213
History of MySQL 214
Installing MySQL 215
MySQL Instance Configuration Wizard 218
Using the MySQL Monitor 223
Data Definition Statements 225
Data Manipulation Language 231
Using PHPMyAdmin 234
Creating a New Database in phpMyAdmin 237
Summary 241
viii Contents
9 Communicating with MySQL 243
Creating the Database 244
Normalization 245
Designing the Database 246
MySQL Data Types 247
Creating the Videos Database 249
The Perl DBI Module 250
Installing Perl DBI 252
Adding Records 254
Displaying Records 259
Removing Records 262
Updating Records 264
Using PHP Extensions 267
Enabling mysqli 267
Creating the Database 269
Adding New Records 270
Viewing Records 274
Deleting Records 279
Updating Records 281
Summary 286
Appendix A An HTML Primer 287
History of HTML 287
GML and SGML - The Origin 287
On to HTML and the WWW 288
HTML Structure 289
Core Tags 289
White Space, Comments, and Case 290
Block-Level Tags 291
Introducing Attributes 295
The Tag 296
Contents ix
Line-Level Elements 296
Anchor Tags and Hyperlinks 301
A Look at Lists 303
A Look at Tables 307
Exploring Forms 309
HTML Special Characters 313
Within the Tag 314
The Future with XML and XHTML 316
XML 317
XHTML 318
Summary 319
Appendix B About the CD-ROM 321
System Requirements 321
Apache HTTP Server Version 2.0 321
Crimson Editor 321
MySQL 4.1 322
ActiveState ActivePerl 322
PHP 4 and 5 322
phpMyAdmin 322
Index 325
x Contents
|