Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What Could Microsoft Do To Make PHP Run Better On Windows


Published on

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

Published in: Technology
  • Be the first to comment

  • Be the first to like this

What Could Microsoft Do To Make PHP Run Better On Windows

  1. 1. What could Microsoft do to make PHP run better on Windows Manuel Lemos Microsoft Web Dev Summit 2008 Redmond, November 18, 2008    
  2. 2. The 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    
  3. 3. Existing pure PHP code based solutions    
  4. 4. Finding and sharing PHP components for Windows ● Some problems can be solved with pure PHP code ● 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:    
  5. 5. Accessing Windows shares that require 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: ● It uses smbclient program to access files with names with the format: smb://user:password@host/path/to/share    
  6. 6. Sending email via SMTP server that requires authentication ● PHP sends email via SMTP on Windows ● The mail() function does not support SMTP authentication ● The MIME message class can solve that problem: ● It supports LOGIN, PLAIN, MD5, NTLM authentication methods via SASL library: ● Comes with easy replacement function smtp_mail()    
  7. 7. Sending e-mail via Microsoft Exchange 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:    
  8. 8. Solutions that require changes on PHP core code for Windows    
  9. 9. Windows implementation of GetMXRR 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:    
  10. 10. HTTP NTLM authentication built-in PHP ● 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    
  11. 11. Better file locking support on Windows ● 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    
  12. 12. Making PHP extensions run with stability 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 <> 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    
  13. 13. Questions? Thank you! Manuel Lemos