SlideShare uma empresa Scribd logo
1 de 27
Baixar para ler offline
PHP RUNS EVERYWHERE
If you can compile it…

 Unix
 Windows

 Linux

 Embedded Systems

 Risc

 NetWare

 I5 (or whatever it’s called this week)
OTHERWISE KNOWN AS
Elizabeth ranting about pet peeves!
CROSS PLATFORM PHP
Write once… run on your phone?
FACTS ARE BETTER THAN WHINING
 Operating systems are different
 Being different is not a bad thing

 Operating systems have a lot of similarities

 Learning the key differences is easy
UNIX BASICS
 What is UNIX?
 Been around a LONG time

 Must conform to Single UNIX specification

 UNIX is the trademark
UNIX DISTRIBUTIONS
   Proprietary                Open Source
     Solaris                    OpenSolaris
     HP-UX                      OpenDarwin (OS X)
     AIX
     OS X



               BSD
                 OpenBSD
                 FreeBSD
                 NetBSD
USING UNIX
     Kernel              Everything is a
     Shell                 File or
     Programs              Process


   Filesystem
     /
                  Case Sensitive
                  CLI based
      /home
                  Can have GUI on top (using X)
      /tmp

      /usr

      /var
UNIX AND SHARED LIBRARIES
ELF                     Mach-O

 Most Linux and UNIX    Mac OS X
 .so files              .dylib files
SO WHAT ABOUT LINUX?
 Linux is just a kernel
 Linux is usually consumed through distributions

 Distributions build GNU utilities and GUI on top

 Most the functionality is identical to UNIX

 There are some differences
LINUX VS. UNIX
Linux                     Unix

 Multiple Vendors         Single Vendor
 Kernel                   Complete System

 Open Source              Mixed

 Usually ext3 and ext4    jfs, gpfs (AIX), jfs, gpfs
                            (HP-UX), jfs, gpfs
                            (Solaris)
WINDOWS BASICS
   Case Insensitive
     You can make it sensitive in NTFS
     The problem is half your windows programs don’t
      know how to do this


   GUI Based (except for Server core – that’s a
    whole nother story)

   Filesystem
     Backends are FAT and NTFS
     If you’re using FAT – get out
     Drive letter abstraction (C:/)
WINDOWS LIBRARIES
   DLL HELL
   SxS is the fix – two people on earth know how to use it
    (documentation …. Sigh)
   What do you need to know about dlls?
       What is my search path

   The directory where the executable module for the current
    process is located.
   The current directory.
   The Windows system directory. The GetSystemDirectory
    function retrieves the path of this directory.
   The Windows directory. The GetWindowsDirectory
    function retrieves the path of this directory.
   The directories listed in the PATH environment variable.
THE HORRIBLE ERROR
 This does not mean what you think it means
 This is passed from the OS (why, I have NO
  CLUE)
 This means “I want a C function from a DLL, I
  can’t find the DLL or the C function – I can’t do
  this, have a nice day”
INSTALLATION AND
CONFIGURATION
Tips to get PHP running wherever you are
UNIX AND LINUX
 Use the distributions
 Compile your own
HOW DISTRIBUTIONS SCREW IT UP
 Patches beyond backporting security fixes
 Additional extensions that change behavior

 Altering header files

 Stripping binaries of symbols

 Experimental Flags on

 Turning off default extensions (--disable-all)

 Take forever to update versions

 --enable-maintainer-zts

 Using system libraries instead of bundled
  versions
HOW DISTRIBUTIONS HELP
 Simple installs for newcomers
 Binaries with locations tailored to the
  environment
 Support

 (Marginally) Sane default settings

 Lots of extensions available
HOW TO DECIDE
 Is this a production box?
 Is this a staging box?

 Is this a development machine?

 Will some crazy person decide to put this live
  from this box for everyone in the company?
WINDOWS
   Windows is the only system for which PHP
    currently provides binaries

 Use PHP’s binaries – we do not screw with the
  source… or
 Use the WebPI installer – they use PHP binaries

 Compile your own, if you’re brave
ON TO THE CODE
Issues that PHP just can’t do for you
ENVIRONMENTAL DIFFERENCES
 $_SERVER contents
 Information about the system
     You can use COM to get information about windows
     Environment information can be different

   Don’t hard code anything
       Make this your mantra
SERVER DIFFERENCES
 IIS
 Apache



   Real difference is in the SAPI not the server

     Fastcgi
     Mod_php
     Isapi (ewww – run away)
     Nsapi
     Etc…
STUPID CODING ISSUES
 Be careful with streams and sockets
 stream_select and stream_set_blocking

 Process spawning (com can help in some cases
  with wscript.shell stuff)
 Using platform specific stuff (pcntl, etc)



   BUT: I see no problem filing a bug if the function
    does not work the same on multiple platforms!
BATCH FILES WON’T KILL YOU
@echo off
dir "C:Program Files" > C:list_of_program_files.txt
dir %1*.mp3 > %2
xcopy %1 %2 /d /s

   Different Commands
   You can stick a bunch of linux command line tools in
    your PATH to make things work better
   http://gnuwin32.sourceforge.net
NEITHER WILL BASH (I PROMISE)
#!/bin/bash
tar -cZf /var/my-backup.tgz /home/me/
grep da * 2> grep-errors.txt



   More like batch files then you think
DIFFERENT IS NOT WRONG
Why knowing the pitfalls leads to more robust code
THANKS!
 Elizabeth M Smith auroraeosrose@gmail.com
 http://www.ee.surrey.ac.uk/Teaching/Unix/

 http://tldp.org/HOWTO/Bash-Prog-Intro-
  HOWTO.html

 http://www.computerhope.com/batch.htm
 http://iis.net/php

Mais conteúdo relacionado

Mais procurados

Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational Biology
AtreyiB
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
julien pauli
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
julien pauli
 

Mais procurados (20)

Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
 
PECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life betterPECL Picks - Extensions to make your life better
PECL Picks - Extensions to make your life better
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
Introduction to Perl
 
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
 
Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational Biology
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extension
 
Unit 1-introduction to perl
Unit 1-introduction to perlUnit 1-introduction to perl
Unit 1-introduction to perl
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
PHP - Introduction to PHP Date and Time Functions
PHP -  Introduction to  PHP Date and Time FunctionsPHP -  Introduction to  PHP Date and Time Functions
PHP - Introduction to PHP Date and Time Functions
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
 

Destaque

Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
Giuseppe Paterno'
 
Accessible dynamic forms
Accessible dynamic formsAccessible dynamic forms
Accessible dynamic forms
Dylan Barrell
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Jeremiah Grossman
 
LAMP Management with Virtualmin
LAMP Management with VirtualminLAMP Management with Virtualmin
LAMP Management with Virtualmin
Joe Ferguson
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins Intro
Casey West
 
Scalable Internet Servers and Load Balancing
Scalable Internet Servers and Load BalancingScalable Internet Servers and Load Balancing
Scalable Internet Servers and Load Balancing
Information Technology
 

Destaque (20)

Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
 
Accessible dynamic forms
Accessible dynamic formsAccessible dynamic forms
Accessible dynamic forms
 
PHP Security Tips
PHP Security TipsPHP Security Tips
PHP Security Tips
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
 
PHP
PHPPHP
PHP
 
Anatomy of Fraud (2010 & 2013)
Anatomy of Fraud (2010 & 2013)Anatomy of Fraud (2010 & 2013)
Anatomy of Fraud (2010 & 2013)
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
 
Cinematic UX Design
Cinematic UX DesignCinematic UX Design
Cinematic UX Design
 
HTML validation, microformats, jQuery
HTML validation, microformats, jQueryHTML validation, microformats, jQuery
HTML validation, microformats, jQuery
 
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
Identifying Web Servers: A First-look Into the Future of Web Server Fingerpri...
 
Knolx j query-form-validation-slides
Knolx j query-form-validation-slidesKnolx j query-form-validation-slides
Knolx j query-form-validation-slides
 
jQuery
jQueryjQuery
jQuery
 
HTML5 & WAI-ARIA Forms with jQuery Validation
HTML5 & WAI-ARIA Forms with jQuery ValidationHTML5 & WAI-ARIA Forms with jQuery Validation
HTML5 & WAI-ARIA Forms with jQuery Validation
 
LAMP Management with Virtualmin
LAMP Management with VirtualminLAMP Management with Virtualmin
LAMP Management with Virtualmin
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins Intro
 
Apache Web Server Setup 2
Apache Web Server Setup 2Apache Web Server Setup 2
Apache Web Server Setup 2
 
Scalable Internet Servers and Load Balancing
Scalable Internet Servers and Load BalancingScalable Internet Servers and Load Balancing
Scalable Internet Servers and Load Balancing
 
Bring a Web Page Alive with jQuery
Bring a Web Page Alive with jQueryBring a Web Page Alive with jQuery
Bring a Web Page Alive with jQuery
 
SydPHP Security in PHP
SydPHP Security in PHPSydPHP Security in PHP
SydPHP Security in PHP
 
Web Security
Web SecurityWeb Security
Web Security
 

Semelhante a Cross platform php

OS Lab: Introduction to Linux
OS Lab: Introduction to LinuxOS Lab: Introduction to Linux
OS Lab: Introduction to Linux
Motaz Saad
 
Intro tounix
Intro tounixIntro tounix
Intro tounix
djprince
 

Semelhante a Cross platform php (20)

Intro tounix (1)
Intro tounix (1)Intro tounix (1)
Intro tounix (1)
 
Intro to linux
Intro to linuxIntro to linux
Intro to linux
 
Linux
LinuxLinux
Linux
 
linux.pdf
linux.pdflinux.pdf
linux.pdf
 
Linux introduction (eng)
Linux introduction (eng)Linux introduction (eng)
Linux introduction (eng)
 
OS Lab: Introduction to Linux
OS Lab: Introduction to LinuxOS Lab: Introduction to Linux
OS Lab: Introduction to Linux
 
Intro tounix
Intro tounixIntro tounix
Intro tounix
 
Unix Administration 1
Unix Administration 1Unix Administration 1
Unix Administration 1
 
IntroToUnix.ppt
IntroToUnix.pptIntroToUnix.ppt
IntroToUnix.ppt
 
IntroToUnix.ppt.intro.to.linuxlinuxintroduction
IntroToUnix.ppt.intro.to.linuxlinuxintroductionIntroToUnix.ppt.intro.to.linuxlinuxintroduction
IntroToUnix.ppt.intro.to.linuxlinuxintroduction
 
Linux
Linux Linux
Linux
 
Foss Presentation
Foss PresentationFoss Presentation
Foss Presentation
 
Intro tounix
Intro tounixIntro tounix
Intro tounix
 
84640411 study-of-unix-os
84640411 study-of-unix-os84640411 study-of-unix-os
84640411 study-of-unix-os
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Linux forensics
Linux forensicsLinux forensics
Linux forensics
 
I Am Linux-Introductory Module on Linux
I Am Linux-Introductory Module on LinuxI Am Linux-Introductory Module on Linux
I Am Linux-Introductory Module on Linux
 
Linux Operating System
Linux Operating SystemLinux Operating System
Linux Operating System
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Linux
LinuxLinux
Linux
 

Mais de Elizabeth Smith

Security is not a feature
Security is not a featureSecurity is not a feature
Security is not a feature
Elizabeth Smith
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
Elizabeth Smith
 
Spl in the wild - zendcon2012
Spl in the wild - zendcon2012Spl in the wild - zendcon2012
Spl in the wild - zendcon2012
Elizabeth Smith
 

Mais de Elizabeth Smith (20)

Welcome to the internet
Welcome to the internetWelcome to the internet
Welcome to the internet
 
Database theory and modeling
Database theory and modelingDatabase theory and modeling
Database theory and modeling
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
 
Modern sql
Modern sqlModern sql
Modern sql
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
 
Php internal architecture
Php internal architecturePhp internal architecture
Php internal architecture
 
Taming the tiger - pnwphp
Taming the tiger - pnwphpTaming the tiger - pnwphp
Taming the tiger - pnwphp
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
Php extensions
Php extensionsPhp extensions
Php extensions
 
Php’s guts
Php’s gutsPhp’s guts
Php’s guts
 
Lexing and parsing
Lexing and parsingLexing and parsing
Lexing and parsing
 
Security is not a feature
Security is not a featureSecurity is not a feature
Security is not a feature
 
Using unicode with php
Using unicode with phpUsing unicode with php
Using unicode with php
 
Mentoring developers-php benelux-2014
Mentoring developers-php benelux-2014Mentoring developers-php benelux-2014
Mentoring developers-php benelux-2014
 
Using unicode with php
Using unicode with phpUsing unicode with php
Using unicode with php
 
Socket programming with php
Socket programming with phpSocket programming with php
Socket programming with php
 
Mentoring developers
Mentoring developersMentoring developers
Mentoring developers
 
Do the mentor thing
Do the mentor thingDo the mentor thing
Do the mentor thing
 
Spl in the wild - zendcon2012
Spl in the wild - zendcon2012Spl in the wild - zendcon2012
Spl in the wild - zendcon2012
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

Cross platform php

  • 1. PHP RUNS EVERYWHERE If you can compile it…  Unix  Windows  Linux  Embedded Systems  Risc  NetWare  I5 (or whatever it’s called this week)
  • 2. OTHERWISE KNOWN AS Elizabeth ranting about pet peeves!
  • 3. CROSS PLATFORM PHP Write once… run on your phone?
  • 4. FACTS ARE BETTER THAN WHINING  Operating systems are different  Being different is not a bad thing  Operating systems have a lot of similarities  Learning the key differences is easy
  • 5. UNIX BASICS  What is UNIX?  Been around a LONG time  Must conform to Single UNIX specification  UNIX is the trademark
  • 6. UNIX DISTRIBUTIONS  Proprietary  Open Source  Solaris  OpenSolaris  HP-UX  OpenDarwin (OS X)  AIX  OS X  BSD  OpenBSD  FreeBSD  NetBSD
  • 7. USING UNIX  Kernel  Everything is a  Shell  File or  Programs  Process  Filesystem /  Case Sensitive  CLI based  /home  Can have GUI on top (using X)  /tmp  /usr  /var
  • 8. UNIX AND SHARED LIBRARIES ELF Mach-O  Most Linux and UNIX  Mac OS X  .so files  .dylib files
  • 9. SO WHAT ABOUT LINUX?  Linux is just a kernel  Linux is usually consumed through distributions  Distributions build GNU utilities and GUI on top  Most the functionality is identical to UNIX  There are some differences
  • 10. LINUX VS. UNIX Linux Unix  Multiple Vendors  Single Vendor  Kernel  Complete System  Open Source  Mixed  Usually ext3 and ext4  jfs, gpfs (AIX), jfs, gpfs (HP-UX), jfs, gpfs (Solaris)
  • 11. WINDOWS BASICS  Case Insensitive  You can make it sensitive in NTFS  The problem is half your windows programs don’t know how to do this  GUI Based (except for Server core – that’s a whole nother story)  Filesystem  Backends are FAT and NTFS  If you’re using FAT – get out  Drive letter abstraction (C:/)
  • 12. WINDOWS LIBRARIES  DLL HELL  SxS is the fix – two people on earth know how to use it (documentation …. Sigh)  What do you need to know about dlls?  What is my search path  The directory where the executable module for the current process is located.  The current directory.  The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.  The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.  The directories listed in the PATH environment variable.
  • 13. THE HORRIBLE ERROR  This does not mean what you think it means  This is passed from the OS (why, I have NO CLUE)  This means “I want a C function from a DLL, I can’t find the DLL or the C function – I can’t do this, have a nice day”
  • 14. INSTALLATION AND CONFIGURATION Tips to get PHP running wherever you are
  • 15. UNIX AND LINUX  Use the distributions  Compile your own
  • 16. HOW DISTRIBUTIONS SCREW IT UP  Patches beyond backporting security fixes  Additional extensions that change behavior  Altering header files  Stripping binaries of symbols  Experimental Flags on  Turning off default extensions (--disable-all)  Take forever to update versions  --enable-maintainer-zts  Using system libraries instead of bundled versions
  • 17. HOW DISTRIBUTIONS HELP  Simple installs for newcomers  Binaries with locations tailored to the environment  Support  (Marginally) Sane default settings  Lots of extensions available
  • 18. HOW TO DECIDE  Is this a production box?  Is this a staging box?  Is this a development machine?  Will some crazy person decide to put this live from this box for everyone in the company?
  • 19. WINDOWS  Windows is the only system for which PHP currently provides binaries  Use PHP’s binaries – we do not screw with the source… or  Use the WebPI installer – they use PHP binaries  Compile your own, if you’re brave
  • 20. ON TO THE CODE Issues that PHP just can’t do for you
  • 21. ENVIRONMENTAL DIFFERENCES  $_SERVER contents  Information about the system  You can use COM to get information about windows  Environment information can be different  Don’t hard code anything  Make this your mantra
  • 22. SERVER DIFFERENCES  IIS  Apache  Real difference is in the SAPI not the server  Fastcgi  Mod_php  Isapi (ewww – run away)  Nsapi  Etc…
  • 23. STUPID CODING ISSUES  Be careful with streams and sockets  stream_select and stream_set_blocking  Process spawning (com can help in some cases with wscript.shell stuff)  Using platform specific stuff (pcntl, etc)  BUT: I see no problem filing a bug if the function does not work the same on multiple platforms!
  • 24. BATCH FILES WON’T KILL YOU @echo off dir "C:Program Files" > C:list_of_program_files.txt dir %1*.mp3 > %2 xcopy %1 %2 /d /s  Different Commands  You can stick a bunch of linux command line tools in your PATH to make things work better  http://gnuwin32.sourceforge.net
  • 25. NEITHER WILL BASH (I PROMISE) #!/bin/bash tar -cZf /var/my-backup.tgz /home/me/ grep da * 2> grep-errors.txt  More like batch files then you think
  • 26. DIFFERENT IS NOT WRONG Why knowing the pitfalls leads to more robust code
  • 27. THANKS!  Elizabeth M Smith auroraeosrose@gmail.com  http://www.ee.surrey.ac.uk/Teaching/Unix/  http://tldp.org/HOWTO/Bash-Prog-Intro- HOWTO.html  http://www.computerhope.com/batch.htm  http://iis.net/php