Pierre Lagarde Christophe Lauer .

32
Développer avec PHP sur Windows Pierre Lagarde blogs.developpeur.org/fox Microsoft France Christophe Lauer blogs.msdn.com/ clauer Microsoft France

Transcript of Pierre Lagarde Christophe Lauer .

Page 1: Pierre Lagarde  Christophe Lauer .

Développer avec PHP sur Windows

Pierre Lagardeblogs.developpeur.org/fox Microsoft France

Christophe Lauer blogs.msdn.com/

clauer Microsoft France

Page 2: Pierre Lagarde  Christophe Lauer .

Bonjour !

Pierre Lagarde

http://blogs.developpeur.org/fox

Christophe Lauerhttp://blogs.msdn.com/clauer

Page 3: Pierre Lagarde  Christophe Lauer .

Agenda

Pourquoi PHP ?PHP sur Windows

PHP et IIS 7 : FastCGIPHP et Microsoft AjaxPHP sur .NET ? Phalanger

Page 4: Pierre Lagarde  Christophe Lauer .

Pourquoi PHP ?

Parce qu’on connait plutôt bien ;)

Le récent accord de collaboration technique avec Zend

Microsoft Ajax Library 1.0Utilisable depuis une application web en PHPFournie sous licence Ms-Pl (Permissive Licence)(Possibilité de Modifier, Redistribuer, utilisation

Commerciale, etc…)

Page 5: Pierre Lagarde  Christophe Lauer .

PHP sur IIS 7.0 : Module FastCGI

Traditionnellement, IIS supporte CGI et ISAPIFastCGI est un protocole standard

Contrairement à CGI, réutilisation des processus

La Tech Preview supporte IIS5.1, IIS6 et séparément IIS7FastCGI améliore :

Performances : Evite de re-créer un process à chaque nouvelle rêquêteStabilité : Garantit l’isolation pour les modules non « thread safe » comme certaines extensions PHP

Page 6: Pierre Lagarde  Christophe Lauer .

L’accord entre Zend et Microsoft

Accord de collaboration techniqueNos deux sociétés cherchent à améliorer les performances et à renforcer la fiabilité et la stabilité de PHP sur Windows Server 2003 et Windows Server « Longhorn »

Microsoft travaille à un nouveau module FastCGIZend mettra en place un laboratoire de tests

Un laboratoire de test Windows pour effectuer des contrôles de qualité afin de maintenir, au niveau le plus haut, les performances de PHP sur Windows Server

Page 7: Pierre Lagarde  Christophe Lauer .

Zend Core For WindowsTechnical Preview

Page 8: Pierre Lagarde  Christophe Lauer .

Amélioration des Performances ?

Installation de base …Avec FastCGI (Technical Preview) …En activant le Cache …

~60 Rps

~120 Rps~6000 Rps

Page 9: Pierre Lagarde  Christophe Lauer .

L’accord entre Zend et Microsoft

« Depuis notre travail préliminaire avec Microsoft, nous avons déjà observé un gain de performances supérieur à 100 %, sur certaines applications PHP s’exécutant sur Windows Server 2003. »

-- Andy Gutmans, co-fondateur et CTO Zend

• Le communiqué de presse :http://www.zend.com/fr/company/zend_news/announcements/2006/10/microsoft_and_zend_technologies_announce_technical_collaboration_to_improve_interoperability_of_php_on_the_windows_server_platform

Page 10: Pierre Lagarde  Christophe Lauer .

DémoFastCGI sur IIS7 (Windows Vista)

Page 11: Pierre Lagarde  Christophe Lauer .

Microsoft Ajax Library

Framework JavaScript proche de la programmation .NET

100% JavaScript compatible IE / Safari / FireFox / Mozila / OperaInclut des libraires de programmation riche :

Traitement de chaînes, Enumérés, DebugUne couche de contrôle, de Drag and Drop, d’animations et autres …

Tout sous la forme de fichiers .js

Page 12: Pierre Lagarde  Christophe Lauer .

ASP.NET “Atlas” Server ExtensionsASP.NET “Atlas” Server Extensions

“Atlas” Server

Controls

“Atlas” Server

Controls

App Services Bridge

App Services Bridge

Web Services Bridge

Web Services Bridge

“Atlas” Framework Serveur“Atlas” Framework Client et Service

“Atlas” Client Script Library“Atlas” Client Script Library

Controls, Components

Controls, Components

Script CoreScript Core

Base Class LibraryBase Class Library

Component Model and UI FrameworkComponent Model and UI Framework

Browser Compatibility

Browser Compatibility

“Atlas” Client Application Services

“Atlas” Client Application Services

Local Store, …

Local Store, …

BrowserIntegrationBrowser

Integration

ASP.NET 2.0ASP.NET 2.0

Application Services

Application Services

Page Framework,

Server Controls

Page Framework,

Server Controls

“Atlas”-enabled ASP.NET Pages

“Atlas”-enabled ASP.NET Pages

Web Services(PHP + JSON)

Web Services(PHP + JSON)

HTML, Script,“Atlas”Markup

HTML, Script,“Atlas”Markup

“Atlas”ServiceProxies

“Atlas”ServiceProxies

Microsoft Ajax Framework Architecture

Page 13: Pierre Lagarde  Christophe Lauer .

Fichiers .jsMicrosoftAjax.js

• Framework + Noyau

MicrosoftAjaxWebForms.js

• Rendu partiel (UpdatePanel)

PreviewScript.js

• Base Class Library (BCL)• Contrôles, XML-Script, etc…

PreviewDragDrop.js

• Drag-and-Drop

PreviewGlitz.js

• Animation, Opacité, etc…

68ko

28ko

35ko

160ko

12ko

Page 14: Pierre Lagarde  Christophe Lauer .

Base Class Library (BCL)

Sys.Preview

• Binding Base

• Binding• Action• InvokeMeth

ode• SetProperty

Sys.Preview.UI

• AutoCompleteBehavior

• Label• Button• CheckBox• TextBox• Selector

Sys.Preview.Data

• DataColumn

• DataRow• DataTable• DataView• DataFilter• DataSource

Sys.Preview.UI.Data

• DataControl• DataNavigato

r• ItemView• ListView• ListItem• XSLTView

Autre

• ServiceMethodeRequest

• Profile

Page 15: Pierre Lagarde  Christophe Lauer .

JavaScript OOPLe Javascript est un langage « object-based » et non pas « object-oriented »Ajout de type étendu

Array – add, contains, remove…BooleanNumber - ParseObject – getType, getTypeNameString – format, endsWith, startWith, trim …

Microsoft Ajax Framework ajouteNamespacesClassesHéritageInterfaceType Enumérés

Page 16: Pierre Lagarde  Christophe Lauer .

String.Format et StringBuildervar s =

String.format(‘{0}, {1} and {2}’, 1, 2, 3);

var sb = new Sys.StringBuilder();for(var i = 0; i<100; i++){ sb.append(i);

sb.append(‘<br/>’}alert(sb.toString());

Page 17: Pierre Lagarde  Christophe Lauer .

Namespaces et Classes Type.registerNamespace('Frimr');

Frimr.Person = function(name) { Frimr.Person.initializeBase(this); this._name = name; } Frimr.Person.prototype = { get_name : function(){ return this._name; } } Frimr.Person.registerClass('Frimr.Person');

Page 18: Pierre Lagarde  Christophe Lauer .

Utiliser la classe Person

var p = new Frimr.Person('Christophe');

alert(p.get_name());alert(Object.getTypeName(p));

Page 19: Pierre Lagarde  Christophe Lauer .

Dérivé de la classe Person

Frimr.Programmer = function(name, language) { Frimr.Programmer.initializeBase(this, [name]); this._language = language; } Frimr.Programmer.prototype = { get_name: function() { var name = Frimr.Programmer.callBaseMethod(this,

'get_name'); return name + '(Programmateur)'; }, get_language: function() { return this._language; } } Frimr.Programmer.registerClass('Frimr.Programmer', Frimr.Person);

Page 20: Pierre Lagarde  Christophe Lauer .

Utiliser la classe Programmervar p2 =

new Frimr.Programmer('Christophe','JavaScript');

alert(p2.get_name());alert(p2.get_language());alert(Object.getTypeName(p2));

Page 21: Pierre Lagarde  Christophe Lauer .

Fonctions Globales et Debug

$create – Crée et initialise un composant

$find – Retrouve un composant avec sont ID

$get – Retrouve un élément dans le DOM [getElementByID]

$addHandler – Ajoute un événement à un objet du DOM

$removeHandler – Supprime un événement à un objet du DOM

debug.trace

Page 22: Pierre Lagarde  Christophe Lauer .

Le JavaScript vs XML-ScriptImpératifvar bt = new Sys.Preview.UI.Button($get('bt'));bt.initialize();bt.add_click(OnClick)

Déclaratif<script type="text/xml-script"> <page xmlns:script="http://schemas.microsoft.com/xml-script/2005"> <components>

<label id="lb"  /><button id="bt">

<click> <setPropertyAction target="tb" property="text"

value="coucou" /> </click>

</button></components>

</page></script>

Page 23: Pierre Lagarde  Christophe Lauer .

PHP et Microsoft Ajax

Utilisation de Microsoft Ajax Library

Utilisation du XML-Script avec des Web Services en PHP et sérialisation JSONhttp://www.codeplex.com/phpmsajax

Utilisation de Ajax Control Toolkit (Extenders)

Page 24: Pierre Lagarde  Christophe Lauer .

DémoUtilisation de Microsoft Ajax LibraryUtilisation de XML-ScriptSlider Extender dans une page PHP

Page 25: Pierre Lagarde  Christophe Lauer .

PHP sur .NET ? Phalanger !

Projet étudiant devenu projet communautaireLicence type Open Source : MS-PLHébergé sur CodePlexVersion 1.0 :

Focalisée sur l’exécution en .NET de code PHP existant

Version 2.0 :Etend ceci via un scénario d’intéropérabilité complêt (ASP.NET, Assemblies, …)

Page 26: Pierre Lagarde  Christophe Lauer .

Phalanger 2.0

Composants majeurs :Compilateur PHP vers MSILSupport de ASP.NETRéimplémentation des classes et modules PHPMySQL Managed ExtensionIntéropérabilité .NET / AssembliesProjets Windows Forms !

Page 27: Pierre Lagarde  Christophe Lauer .

Phalanger 2.0

Beta 2 :MySQL Managed Extension

Beta 3 :Quelques corrections Visual Studio Integration Bêta

Page 28: Pierre Lagarde  Christophe Lauer .

DémoProjet Phalanger

Application existante (Wordpress)

ASP.NET en PHP et Ajax Extenders

Page 29: Pierre Lagarde  Christophe Lauer .

En synthèse…

Plein de bonnes choses pour les développeurs PHP sur Windows !

Microsoft Ajax LibraryWeb Services et JSONIIS7Phalanger et ASP.NET, plus Extenders Ajax

Page 30: Pierre Lagarde  Christophe Lauer .

La référence technique

pour les IT Pros :technet.microsoft.com

La référence techniquepour les développeurs :msdn.microsoft.com

S’informer - Un portail d’informations, des événements, une newsletter bimensuelle personnalisée

Se former - Des webcasts, des articles techniques, des téléchargements, des forums pour échanger avec vos pairs

Bénéficier de services - Des cursus de formations et de certifications, des offres de support technique

Visual Studio 2005 +

Abonnement MSDN Premium

Abonnement TechNet Plus :

Versions d’éval + 2 incidents support

Page 31: Pierre Lagarde  Christophe Lauer .

Merci !

Page 32: Pierre Lagarde  Christophe Lauer .

© 2007 Microsoft France

Votre potentiel, notre passion TM