Integrating PHP with Windows
Arno Hollosi
Copyright 2011
All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher.
1 2 3 4 5 6 7 8 9 M 6 5 4 3 2 1
Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Book Support at .
Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners.
The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, place, or event is intended or should be inferred.
This book expresses the authors views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, OReilly Media, Inc., Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book.
Acquisitions and Developmental Editor: Russell Jones
Production Editor: Holly Bauer
Editorial Production: Octal Publishing, Inc.
Technical Reviewer: Lars Dekenno
Copyeditor: Bob Russell
Indexer: Julie Hawks
Cover Design: Twist Creative Seattle
Cover Composition: Karen Montgomery
Illustrator: Robert Romano
Author Photo: FH CAMPUS 02/Peter Melbinger
Microsoft Press
Introduction
PHP has changed the world: no other language has influenced and spurred web development so strongly. From simple home pages to social software and business applications to the largest global websites, PHP has played a leading role for years. Simultaneously, Microsoft and its Windows operating system has made computers available to all households. Along with Internet Information Services (IIS) for Windows Server, Microsoft SQL Server, Microsoft Active Directory, and Microsoft Exchange Server, it has created a solid and powerful platform for organizations and companies, as well. Microsoft recognizes the potential that lies in supporting PHP in its own products, and is now explicitly incorporating PHP into its development strategy, thus promoting interoperability with the Windows platform.
Thanks to the recent efforts by the Windows PHP team, including Pierre Joye, Ruslan Yakushev, and others, the combination of IIS and PHP is now faster, more stable, more secure, and easier to manage than ever. These effortsFastCGI, WinCache, PHP Manager, new drivers for SQL Server, the integration with Microsofts Web Platform Installer (Web PI), as well as development aids for Windows Azure, Virtual Earth, Webslices, Silverlight, and SQL Server (just to name a few)make PHP development on Windows an enjoyable and productive experience.
Combined with the ever-improving interoperability of Microsofts products, PHP is ready for just about every task in corporate environments. Whether you want to access Exchange Server through its SOAP web services, manage users in Active Directory with Lightweight Directory Access Protocol (LDAP), or use Windows credentials to provide seamless authentication of your users, PHP is up to the task.
In addition, Microsoft provides extensive developer documentation on its MSDN developer network and on TechNet, which leaves few common questions unanswered. Also, several of Microsofts core PHP developers share valuable insights, tips, and tricks on their blogs.
If, like me, you have mostly been using PHP with Apache and MySQL, you should be excited about the functionality, stability, performance, and integrated security architecture of the Microsoft platform. This book shows you how to run your PHP applications effectively and securely with IIS and SQL Server, and how to access user data in Active Directory as well as the calendar and email data in Exchange Server.
Who Should Read This Book
This book exists to introduce PHP developers to Microsofts web and database technologies. It is also especially useful for programmers developing applications that interface with Microsoft Active Directory or Microsoft Exchange Server.
After reading this book, you will have a deep understanding of how PHP interacts with IIS so that you can tweak your configuration for optimal security and performance. You will know how to access SQL Server, which authentication model is best suited for your needs, how to perform full-text searches, and how to interface with stored procedures. You will be able to access Active Directory to manage users and groups, or use it for authentication purposes. And finally, you will be able to use Exchange Web Services (EWS) to read and write emails, organize meetings, and manage your calendar.
Assumptions
This book assumes that you already have some experience in developing PHP applications and accessing relational database systems (for example, with Apache and MySQL). You should also be familiar with basic web concepts, such as the HTTP request/response cycle, and be familiar with the concepts of the relational database model, such as tables and rows, and have dabbled in SQL. In addition, this book assumes that you have a basic understanding of XML, because XML is used for configuration files and Exchange Servers SOAP web services.
Although this book describes the necessary steps to set up IIS, SQL Server, Active Directory, and Exchange Server, as well as the necessary steps to follow the given examples, it is not by any means a comprehensive description of these products. Therefore, you should have a minimal understanding of the purpose and function of these systems.
Who Should Not Read This Book
Not every book is aimed at every possible audience. If you have no prior experience with PHP or database systems, you might have a hard time following the explanations. Also, if you expect a complete introduction to Active Directory or Exchange Server, you might be disappointedtheres simply not enough room in a single book.
Organization of This Book
This book introduces you to programming IIS, SQL Server, Active Directory, and Exchange Server. In each section, you will learn how to set up your development environment, the basic architecture and inner workings of these systems, and how to implement common tasks in PHP. Example configurations and listings illustrate each point and help you to improve your understanding and achieve your goals. This book attempts to lower the entry barrier for programming these systems as well as to thoroughly prepare you for further exploration of Microsofts ecosystem.
This book is divided into four sections that roughly correspond to the technologies discussed. Depending on your interest or prior knowledge, you can jump directly to any section. The four sections are:
. This part discusses how PHP can be integrated into IIS and how IIS processes a request. You will gain a solid understanding of how to configure IIS and how it operates. This part is especially useful if you are switching to IIS from another web server. The chapters in this part discuss how to secure your PHP applications against attacks, how to use caching to dramatically increase the performance of your application, and how you can use URL Rewrite to create user-friendly URLs.