what could microsoft do to make php run better on windows

13

Click here to load reader

Upload: manuel-lemos

Post on 24-May-2015

7.031 views

Category:

Technology


2 download

DESCRIPTION

Presentation given by Manuel Lemos in Microsoft Web Development Summit 2008 about suggestions of things that Microsoft could do or help doing to make PHP run better on Windows

TRANSCRIPT

Page 1: What Could Microsoft Do To Make PHP Run Better On Windows

   

What could Microsoft do to make PHP What could Microsoft do to make PHP run better on Windowsrun better on Windows

Manuel [email protected]

www.prophp.com.br

www.php.org.br

Microsoft Web Dev Summit 2008

Redmond, November 18, 2008

Page 2: What Could Microsoft Do To Make PHP Run Better On Windows

   

The problemsThe problems

● PHP Windows developers face challenges that they would not face when using PHP on other platforms

● Some PHP features do not work well on Windows● Some Windows specific features are not supported

directly by PHP extensions● PHP core lacks of Windows developers● “PHP Windows developers are second-class citizens”

– Rasmus Lerdord – PHP creator● Microsoft may help

Page 3: What Could Microsoft Do To Make PHP Run Better On Windows

   

Existing pure PHP code based solutions

Page 4: What Could Microsoft Do To Make PHP Run Better On Windows

   

Finding and sharing PHP components Finding and sharing PHP components for Windowsfor Windows

● Some problems can be solved with pure PHP code

● PHPClasses.org site distributes contributed solutions in the form of classes of objects

● Anybody can contribute with their own PHP classes

● There is a category for Windows specific components:

www.phpclasses.org/browse/class/69.html

Page 5: What Could Microsoft Do To Make PHP Run Better On Windows

   

Accessing Windows shares that Accessing Windows shares that require authenticationrequire authentication

● PHP cannot access files on Windows remote shares that require authentication

● Victor Varela from Spain solved the problem with the stream wrapper class SMB4PHP:

www.phpclasses.org/smb4php

● It uses smbclient program to access files with names with the format:

smb://user:password@host/path/to/share

Page 6: What Could Microsoft Do To Make PHP Run Better On Windows

   

Sending email via SMTP server that Sending email via SMTP server that requires authenticationrequires authentication

● PHP sends email via SMTP on Windows

● The mail() function does not support SMTP authentication

● The MIME message class can solve that problem:

www.phpclasses.org/mimemessage

● It supports LOGIN, PLAIN, MD5, NTLM authentication methods via SASL library:

www.phpclasses.org/sasl

● Comes with easy replacement function smtp_mail()

Page 7: What Could Microsoft Do To Make PHP Run Better On Windows

   

Sending e-mail via Microsoft Sending e-mail via Microsoft Exchange mail pickup folderExchange mail pickup folder

● PHP can queue email much faster when Microsoft Exchange queue pickup folder is available

● Just create email files and drop in the pickup folder

● The MIME message class comes with a sub-class specialized in queuing messages that way:

www.phpclasses.org/mimemessage

Page 8: What Could Microsoft Do To Make PHP Run Better On Windows

   

Solutions that require changes on PHP core code for

Windows

Page 9: What Could Microsoft Do To Make PHP Run Better On Windows

   

Windows implementation of Windows implementation of GetMXRR functionGetMXRR function

● The DNS MX records point to the SMTP server that receives messages for a given domain

● Emulating a delivery to the SMTP server in the MX records can be used to verify if a e-mail is valid

● GetMXRR() function returns the MX records but it is not implemented in PHP under Windows

● A patch to PHP could enable the GetMXRR() function under Windows, so very popular e-mail validation components could also be used in PHP on Windows:

www.phpclasses.org/emailvalidation

Page 10: What Could Microsoft Do To Make PHP Run Better On Windows

   

HTTP NTLM authentication built-in HTTP NTLM authentication built-in PHPPHP

● NTLM protocol is used to authenticate users during Windows logon

● Web servers that require this authentication on the same Windows domain can reuse credentials to avoid asking passwords again to the users

● PHP has built-in HTTP basic authentication support but not NTLM. It depends on Web server extensions and additional configuration not integrated with PHP

● Built-in NTLM authentication support independent of the Web server would be better

Page 11: What Could Microsoft Do To Make PHP Run Better On Windows

   

Better file locking support on Better file locking support on WindowsWindows

● File locking is used to prevent corruption of files being changed by multiple users at the same time

● Examples: content caching and access counters

● PHP file locking function flock() do not work well under Windows

Page 12: What Could Microsoft Do To Make PHP Run Better On Windows

   

Making PHP extensions run with Making PHP extensions run with stability in multithreaded Web serversstability in multithreaded Web servers

● Multithreaded Web servers like IIS and Apache 2 (worker) take less memory to serve the same number of simultaneous HTTP requests

● Less memory per request leads to less costs to scale● PHP is mostly thread-safe but some extensions and

dependency libraries aren't● Making C/C++ code thread-safe is not a trivial task● Dr. Sagar Chaki <[email protected]> developed a

tool named Beacon to verify code thread safety● Beacon could be used to certify which extensions are

thread-safe and which need to be fixed

Page 13: What Could Microsoft Do To Make PHP Run Better On Windows

   

Questions?Questions?

Thank you!

Manuel Lemos

[email protected]

www.prophp.com.br

www.php.org.br