PHP & Windows Jan Burkl System Engineer, Zend Technologies
Wer bin ich? Jan Burkl jan.burkl@zend.com PHP Entwickler seit 2001 Projektarbeit Bei Zend seit 2006 System Engineer Zend Certified Engineer PHP 5 Zend Framework
Agenda Geschichte & Background Optimierungen Zend Server unter Windows SQL Server
Aktuell Stand 03.08.2010 PHP 5.3.3 PHP 5.2.14 http://windows.php.net/download/
Geschichte Oktober 2000 PHP 3.0.17 (Thread Safe) auf Windows (Multi-Threaded-Architektur) CGI: stabil, aber laaaaangsam (wg. Multi-Process-Modell, php.ini) ISAPI Modul für IIS: schneller, aber Crashes Performance Opcode Caches: Z.B. eaccelerator (Thread Safe) FastCGI wenig/keine Inkompatibilität zu PHP Extensions PHP 5.2.1 Non Thread Safe (NTS) kein Warten auf Thread Synchronisation FastCGI Handler von Microsoft FastCGI + NTS = Performance Boost
Background Microsoft und Zend haben eine enge Partnerschaft Oktober 2006 Unternehmen arbeiten gemeinsam an der Verbesserung von PHP unter Windows PHP auf Windows ist schneller, sicherer und skaliert besser
PHP unter Windows Wir sind uns bewusst, dass PHP nicht immer problemlos auf der Windows-Plattform lief, deshalb haben wir Windows Server dahingehend optimiert, dass Ihre PHP-Anwendungen von einer neuen Komponente unterstützt werden: FastCGI. FastCGI arbeitet als Interface zwischen der PHP Engine und IIS und gewährleistet, dass PHP schneller läuft als mit CGI und viel zuverlässiger als PHP ISAPI. Quelle: http://www.microsoft.com/web/platform/phponwindows.aspx
Technologie Partnerschaft Signifikante technische Fortschritte: PHP ist schneller und stabiler alle Verbesserungen fließen zur Community zurück Server 2003, 2008, Vista, Win 7 SQL Server Treiber für PHP FastCGI Implementierung für IIS http://php.iis.net/
PHP optimiert für Windows PHP 5.3 wurde für Windows optimiert Performance Optimierungen POSIX (Schnittstelle zwischen Applikation und dem Betriebssystem) Aufrufe zu nativen Win32 API s geändert Viele Windows-spezifische und FastCGI-spezifische Performance Verbesserungen 60+ Windows-spezifische Bugs gefixed Non-thread-safe Builds für maximale Performance mit IIS FastCGI
Top Servers Across the Million Busiest Sites Developer May 2010 Percent June 2010 Percent Change Apache 664,186 66.82% 662,169 66.61% -0.21 Microsoft 167,740 16.87% 169,418 17.04% 0.17 nginx 48,598 4.89% 49,530 4.98% 0.09 Google 19,367 1.95% 19,425 1.95% 0.01 Quelle: http://news.netcraft.com/archives/2010/06/16/june-2010-web-server-survey.html#more-2249
Zend Server
Zend Server - Web Application Server verbesserte PHP Applikationsperformance Application Monitoring und Diagnostik Produktionsfähiger PHP Stack inklusive Zend Framework technischer Support, Software Updates und Security Hotfixes Zend Studio Integration für vereinfachtes Debugging http://www.zend.com/de/products/server/downloads
Installation Zend Server Native Installationsroutine PHP 5.2 PHP 5.2.14 release marks the end of the active support for PHP 5.2 Kein End-Of-Life für Zend Server mit PHP 5.2! VC8 PHP 5.3 VC9
Kleiner Performance Test Zend Server vs. XAMPP Zend Controller Zend Server: PHP 5.3.2 XAMPP: PHP 5.3.1 Stand: 02.08.2010
Zusammenfassung Performancegewinn durch FastCGI Optimizer+ (Byte-Code-Acceleration / Opcode-Cache) Page Cache Data Cache Demo
Konfiguration
FastCGI http://files.zend.com/help/zend- Server/configuring_iis_timeouts.htm IIS-Konfiguration XML (IIS 7): C:\Windows\System32\inetsrv\config\applicationHost.config <fastcgi> <application fullpath="e:\zend\zendserver\bin\php-cgi.exe" maxinstances="10" instancemaxrequests="10000"> <environmentvariables> <environmentvariable name="phprc" value="e:\zendserver\etc" /> <environmentvariable name="php_fcgi_max_requests" value="10000" /> </environmentvariables> </application> </fastcgi>
Debugging Debug-Prozess bricht nach 30 Sekunden ab Default-Werte für activitytimeout & requesttimeout Demo <application fullpath="e:\zend\zendserver\bin\php-cgi.exe" maxinstances="10" instancemaxrequests="10000" activitytimeout="300" requesttimeout="300">
SQL Server
Microsoft SQL Server Native Client
Microsoft SQL Server Native Client Microsoft SQL Server 2008 Native Client http://www.microsoft.com/downloads Suche nach SQL Server Native Client
SQL Server Extension
Zugriff mit Zend Framework Zend_Db_Adapter_Sqlsrv Demo $db = Zend_Db::factory( 'Sqlsrv', array( 'host' => 'dbhost', 'username' => 'jan', 'password' => '******', 'dbname' => 'AdventureWorks' ) );
SQL Server Driver for PHP 2.0 http://www.microsoft.com/downloads Suche nach SQL Server Driver for PHP Neu: PDO! Demo
Dankeschön! jan@zend.com