php apache vs iis by hafedh yahmadi
TRANSCRIPT
palais des congrès Tunis
8 et 9 février 2012
PHP / APACHE & MICROSOFT
Yahmadi Hafedh – DPE Microsoft Tunisie
Agenda
1. PHP for Windows Qu’est ce que PHP ? Que peut Faire PHP ? Windows IIS avec PHP. Demo
2. Web Server (IIS & Apache) 3. IIS features in details 4. Case Study + demo 5. PHP on the Cloud 6. Conclusion
Titre 1
Introduction
PHP For Windows 1
What is PHP? PHP stands for "PHP
Hypertext Preprocessor” An embedded scripting
language for HTML like ASP or JSP
A language that combines elements of Perl, C, and Java
History of PHP Created by Rasmus Lerdorf in
1995 for tracking access to his resume
Originally a set of Perl scripts known as the “Personal Home Page” tools
Rewritten in C with database functionality
Qu’est ce que PHP?
PHP is used by 77.2% of all the websites whose server-side programming language we know.
PHP 77.2% ASP.NET 21.7% Java 4.1% ColdFusion 1.2% Perl 1.0% Ruby 0.6% Python 0.3%
W3Techs.com, 6 Dec 2011
This Table shows the percentages of websites using various versions of PHP.
Version 5 94%
Version 4 06%
Version 3 Less than 0.1%
Version 6 Less than 0.1%
W3Techs.com, 6 Dec 2011
The Script Tags All PHP code is contained in
one of several script tags: <?
// Some code ?>
<?php // Some code here ?>
The Script Tags (cont.) <script language=“PHP">
// Some code here </script>
ASP-style tags Introduced in 3.0; <% // Some code here %>
PHP Language Basics
1. Sites Web et applications Web (script côté serveur)
2. Scripts en ligne de commande
3. Ecrire Applications à interface graphique (GUI)
C'est l'utilisation la plus traditionnelle. Ecrire des scripts PHP et l'exécuter en ligne de commande (Cron) PHP-GTK
Que peut Faire PHP ?
Code Portability The obvious: don’t use Unix or
Windows specific functions Create a reusable module for file
system differences, for example: • if( PHP_OS == "Linux" )
{ $ConfigPath = "/var/www/conf"; $DataPath = "/var/www/data"; }
Code Portability if( ereg("WIN", PHP_OS) )
{ $ApachePath = “C:/Program Files/Apache Group/Apache”; $ConfigPath = ”$ApachePath/htdocs/conf"; $DataPath = "$ApachePath/htdocs/data"; }
PHP on Linux and Windows (Portability OS, WebServer, OOP, Protocol, BD)
DEMO
Donwload PHPonWindows&SQLServerTrainingKit
from http://www.microsoft.com/download/en/details.aspx?id=8887
PHP Installer from : http://Windows.php.net
Titre 1
PHP For Windows
Web Server (IIS & Apache) 2 Durant des decencies Apache Foundation et Microsoft dominent les servers web shares
IIS 3.0 in option in Windows NT 4.0 IIS 5.0 was included in Windows 2000 in both server and Desktop IIS 5.1 part of XP Windows Server 2003 includes the new IIS 6.0 Windows Server 2008 (R2) includes IIS7.5
Internet Information Server
Free web server. Often combined with Linux, MySQL, and PHP to make the LAMP stack. First released in 1995. Modular architecture. Built using an open source development model. Commercial friendly open-source license. Current stable Version is 2.2.22 which was released in 31 January 2012
APACHE Overview
Proven Scalability and Stability Used by many major sites
and companies such as MySpace.com, Match.com, US Bank, USA Today, Allstate, Continental Airlines and others.
Significant increase in reliability of hosted web sites compared to IIS 5.0.
A solid trusted foundation for IIS 7.0
IIS 6.0 – A Solid Foundation Shipped with Windows
Server 2003 Proven Security
Significant reduction in attack surface compared to previous releases
IIS 6 Overview
IIS7 Overview Benefits Features
Modular and Extensible Integrated with .NET Improved Security Agile Administration Built in Request
Tracing
Reduced Attack Surface
Easier to Manage Fast Diagnostics
Extend/Modify IIS Features
Create Streamlined
Servers
IIS 7 Overview
Titre 1
PHP For Windows
IIS Features in details 3
Questions “Which of the two platforms (IIS and Apache)
is more secure?”
“Which is easier to manage?”
“Is Apache or IIS easier to manage?”
“Which web server is more reliable?”
“Which is more modular, IIS or Apache?”
“Is IIS or Apache more innovative?”
“Is IIS or Apache easier to troubleshoot?”
“Does Apache support more applications?”
“Does IIS or Apache have the lower TCO?”
“Is Apache the best platform for PHP Applications?”
IIS / Security Development Lifecycle Automatic Update Patching Security Tracking – Secunia
IIS 7.0 Security Minimal Surface Area Automatic Site / Application
Sandboxing Anonymous User Account
Changes URL Authorization Built in Request Filtering Integrated Active Directory
Authorization
Security
IIS 7.0 Manageability Centralized Web Farm
Configuration Streamlined and Focused
Administration Tool Remote Administration Tool Command Line
Administration Rapid Troubleshooting and
Limited Downtime
Management
Enterprise Level Performance “Match.com runs IIS 7.0 with
30 million page views daily.” “PlentyOffFish.com gets 1.2
billion page views a month.” “WS2008 and IIS 7.0 allow
www.microsoft.com to process 122 million more requests at the same CPU level – compared to IIS 6.0”
“MySpace.com runs IIS 7.0 with 23 billion page views a month.”
IIS 7.0 Performance/Scalability Leaner Web Servers Server Core Static and Dynamic
Compression Output Caching
Improvements
Performance / Scalability
IIS 7.0 Modularity Server functionality is split
into 40 modules Only 10 modules installed
by default Modules and a Generic
Pipeline Extensibility
IIS 7.0 Reliability Proven and Trusted Platform
54% of the Fortune 1000 rely on IIS 7.0
Rapid diagnostics tools to troubleshoot any concerns quickly Failed Request Tracing Runtime State and Control
API.
Reliability / Modularity
IIS 7.0 Innovation IIS 7.0 Admin Pack URL Rewrite Module
(Technical Preview) PowerShell Provider for IIS Remote Manager – IIS 7 UI
for Down-level Clients Web Playlists
Innovation
IIS 7.0 Troubleshooting Detailed Error Messages
Verbose Error Messages Suggests Causes and
Solutions Details include
configuration sections in question, modules in use, page, etc.
Failed Request Tracing Allows for custom
failure criteria per URL Persist Failure Log Files
beyond process lifetime Common Usages
Request take too long
Request Error (completes but with error code)
Troubleshooting
IIS 7.0 Application Support Extensible, modular architecture
– add, remove or replace any built-in module
Enhanced ASP.NET integration including unified configuration, HTTP runtime and administration tools
Caching support (kernel and user) for all types of dynamic content
Built-in FastCGI support for Open Source frameworks such as PHP and Ruby.
Strong integration with other Enterprise Products such as SharePoint
Extensive Support for Streaming Media
Application Support
IIS 7.0 - Cost of Ownership Rapid Troubleshooting and
Minimized Downtime Minimized Surface Area Isolation and Sandboxing Scalable Multi-Tenant
Hosting
Less Expensive Administrator Resources to Maintain
Delegated Control to Site Owners
Strong Microsoft Support Resources
TCO
IIS 7.0 and PHP Support Consolidate .NET and PHP
applications on a single server Consolidate Web and Other Server
Management Frameworks to a single platform
Better Web Platform Management
Host on Minimal / Headless Server with Server Core
Powerful Media Serving Microsoft Supported Solution
PHP Applications
IIS 7.0 has: A Modular and Extensible
Architecture Deep integration with .NET
Applications Improved Security Agile Administration Built in Troubleshooting Tools
such as Request Tracing
This leads to a Web Platform that is: Streamlined Easy to extend To Manage Quick to Troubleshoot Highly Secure
Summary
Titre 1
PHP For Windows
Case Study + demo 4
Titre 1
Windows Azure Platform + PHP
PHP ON The Cloud 5
Introducing the Windows Azure Platform
Private (On-Premise)
Infrastructure (as a Service)
Platform (as a Service)
Types of Clouds
Storage
Server HW
Networking
Servers
Databases
Virtualization
Runtimes
Applications
Security & Integration
Storage
Server HW
Networking
Servers
Databases
Virtualization
Runtimes
Applications
Security & Integration
Storage
Server HW
Networking
Servers
Databases
Virtualization
Runtimes
Applications
Security & Integration
You
man
age M
anaged by vendor
Managed by vendo
Yo
u m
anag
e
You
man
age
Private (On-Premise)
Types of Clouds Infrastructure
(as a Service) Platform
(as a Service)
Windows Azure for Application Developers
Portal Hosted Service
Storage
SDK
Develop Deploy Run
Windows Azure Compute Roles
Role
Code Configuration
Web vs. Worker Role Web Role
IIS Host
Your Code
Worker Role
System Host
Your Code
Sample Application Architecture
http://yourapp.cloudapp.net
Running PHP in Windows SDK for PHP @ http://phpazure.codeplex.com How to Do It Host in Web role (like .NET) Supply PHP runtime Point to runtime via FastCGI
configuration in Web.config Web.roleconfig
PHP Web Role Instance 2
VI P
Load
Ba
lanc
er
PHP Web Role Instance 1
This is all you need! \HelloCloudPHP
ServiceDefinition.csdef ServiceConfiguration.cscfg \WebRole web.roleconfig web.config \php index.php <your php application> etc...
Make sure you change your php.ini to use relative paths!
PHP with SQL Azure SQL Server Driver for PHP @
http://sqlsrvphp.codeplex.com/
Supports PHP access to SQL Azure
Features Choose between SQL Server and SQL Azure by changing
connection string Use from on-premises or in Windows Azure
Lastly, Microsoft can help your company! BizSpark www.bizspark.com
For startups
Less than 3 years old Less than USD 1M in annual revenue Must make software product or service
You get a bunch of free stuff (software,
support, visibility)
Free Windows Azure usage (up to a certain limit)
WebsiteSpark www.websitespark.com
For companies that build web sites and
applications for their customers Less than 10 employees
You get a bunch of free stuff (software,
support, visibility)
No Windows Azure usage unfortunately…
Titre 1 MERCI
ND E