320 likes | 437 Views
Développer avec PHP sur Windows. Pierre Lagarde blogs.developpeur.org/fox Microsoft France. Christophe Lauer blogs.msdn.com/ clauer Microsoft France. Bonjour !. Pierre Lagarde http://blogs.developpeur.org/fox Christophe Lauer http://blogs.msdn.com/clauer. Agenda. Pourquoi PHP ?
E N D
Développer avec PHP sur Windows Pierre Lagarde blogs.developpeur.org/fox Microsoft France Christophe Lauer blogs.msdn.com/clauer Microsoft France
Bonjour ! Pierre Lagarde http://blogs.developpeur.org/fox Christophe Lauer http://blogs.msdn.com/clauer
Agenda • Pourquoi PHP ? • PHP sur Windows • PHP et IIS 7 : FastCGI • PHP et Microsoft Ajax • PHP sur .NET ? Phalanger
Pourquoi PHP ? • Parce qu’on connait plutôt bien ;) • Le récent accord de collaboration technique avec Zend • Microsoft Ajax Library 1.0 • Utilisable depuis une application web en PHP • Fournie sous licence Ms-Pl (Permissive Licence) (Possibilité de Modifier, Redistribuer, utilisation Commerciale, etc…)
PHP sur IIS 7.0 : Module FastCGI • Traditionnellement, IIS supporte CGI et ISAPI • FastCGI est un protocole standard • Contrairement à CGI, réutilisation des processus • La Tech Preview supporte IIS5.1, IIS6 et séparément IIS7 • FastCGI améliore : • Performances : Evite de re-créer un process à chaque nouvelle rêquête • Stabilité : Garantit l’isolation pour les modules non « thread safe » comme certaines extensions PHP
L’accord entre Zend et Microsoft • Accord de collaboration technique • Nos 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 FastCGI • Zend 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
Amélioration des Performances ? • Installation de base … • Avec FastCGI(TechnicalPreview) … • En activant le Cache … ~6000 Rps ~120 Rps ~60 Rps
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
Démo FastCGIsur IIS7 (Windows Vista)
Microsoft Ajax Library • Framework JavaScript proche de la programmation .NET • 100% JavaScript compatible IE / Safari / FireFox / Mozila / Opera • Inclut des libraires de programmation riche : • Traitement de chaînes, Enumérés, Debug • Une couche de contrôle, de Drag and Drop, d’animations et autres … • Tout sous la forme de fichiers .js
“Atlas” Client Script Library Controls, Components ASP.NET “Atlas” Server Extensions App Services Bridge Component Model and UI Framework “Atlas” Client Application Services “Atlas” Server Controls Web Services Bridge Base Class Library Local Store, … Script Core ASP.NET 2.0 Browser Integration Page Framework, Server Controls Application Services Browser Compatibility Microsoft Ajax Framework Architecture HTML, Script, “Atlas” Markup “Atlas”-enabled ASP.NET Pages “Atlas” Service Proxies Web Services (PHP + JSON) “Atlas” Framework Serveur “Atlas” Framework Client et Service
Fichiers .js 68ko 28ko 160ko 35ko 12ko
JavaScript OOP • Le Javascript est un langage « object-based » et non pas « object-oriented » • Ajout de type étendu • Array – add, contains, remove… • Boolean • Number - Parse • Object – getType, getTypeName • String – format, endsWith, startWith, trim … • Microsoft Ajax Framework ajoute • Namespaces • Classes • Héritage • Interface • Type Enumérés
String.Format et StringBuilder var 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());
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');
Utiliser la classe Person var p = new Frimr.Person('Christophe'); alert(p.get_name()); alert(Object.getTypeName(p));
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);
Utiliser la classe Programmer var p2 = new Frimr.Programmer('Christophe','JavaScript'); alert(p2.get_name()); alert(p2.get_language()); alert(Object.getTypeName(p2));
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
Le JavaScript vs XML-Script • Impératif var 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> <setPropertyActiontarget="tb" property="text" value="coucou" /> </click> </button> </components> </page> </script>
PHP et Microsoft Ajax • Utilisation de Microsoft Ajax Library • Utilisation du XML-Script avec des Web Services en PHP et sérialisation JSON • http://www.codeplex.com/phpmsajax • Utilisation de Ajax Control Toolkit (Extenders)
Démo Utilisation de Microsoft Ajax Library Utilisation de XML-Script Slider Extender dansune page PHP
PHP sur .NET ? Phalanger ! • Projet étudiant devenu projet communautaire • Licence type Open Source : MS-PL • Hébergé sur CodePlex • Version 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, …)
Phalanger 2.0 • Composants majeurs : • Compilateur PHP vers MSIL • Support de ASP.NET • Réimplémentation des classes et modules PHP • MySQL Managed Extension • Intéropérabilité .NET / Assemblies • Projets Windows Forms !
Phalanger 2.0 • Beta 2 : • MySQL Managed Extension • Beta 3 : • Quelques corrections • Visual Studio Integration Bêta
Démo ProjetPhalanger Application existante (Wordpress) ASP.NET en PHP et Ajax Extenders
En synthèse… • Plein de bonneschoses pour les développeurs PHP sur Windows ! • Microsoft Ajax Library • Web Services et JSON • IIS7 • Phalanger et ASP.NET, plus Extenders Ajax
La référence technique • pour les développeurs : • msdn.microsoft.com La référence technique pour les IT Pros : technet.microsoft.com Abonnement TechNet Plus : Versions d’éval + 2 incidents support Visual Studio 2005 + Abonnement MSDN Premium • 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
Votre potentiel, notre passion TM © 2007 Microsoft France