SlideShare a Scribd company logo
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

More Related Content

What's hot

Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
Danairat Thanabodithammachari
 
IO Streams, Files and Directories
IO Streams, Files and DirectoriesIO Streams, Files and Directories
IO Streams, Files and Directories
Krasimir Berov (Красимир Беров)
 
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
ZendCon
 
Introduction to Perl
Introduction to PerlIntroduction to Perl
System Programming and Administration
System Programming and AdministrationSystem Programming and Administration
System Programming and Administration
Krasimir Berov (Красимир Беров)
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and Desktop
Elizabeth Smith
 
Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational BiologyAtreyiB
 
Power of Puppet 4
Power of Puppet 4Power of Puppet 4
Power of Puppet 4
Martin Alfke
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
julien pauli
 
Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objectsjulien pauli
 
Mysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extensionMysqlnd, an unknown powerful PHP extension
Mysqlnd, an unknown powerful PHP extension
julien pauli
 
Unit 1-introduction to perl
Unit 1-introduction to perlUnit 1-introduction to perl
Unit 1-introduction to perl
sana mateen
 
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)
julien pauli
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
julien pauli
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshopjulien pauli
 
Memory Management In Python The Basics
Memory Management In Python The BasicsMemory Management In Python The Basics
Memory Management In Python The Basics
Nina Zakharenko
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
Elizabeth Smith
 
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
Vibrant Technologies & Computers
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3
Bradley Holt
 

What's hot (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
 

Viewers also liked

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 LinuxGiuseppe Paterno'
 
Accessible dynamic forms
Accessible dynamic formsAccessible dynamic forms
Accessible dynamic formsDylan Barrell
 
jQuery: Events, Animation, Ajax
jQuery: Events, Animation, AjaxjQuery: Events, Animation, Ajax
jQuery: Events, Animation, Ajax
Constantin Titarenko
 
PHP
PHPPHP
Anatomy of Fraud (2010 & 2013)
Anatomy of Fraud (2010 & 2013)Anatomy of Fraud (2010 & 2013)
Anatomy of Fraud (2010 & 2013)
Jerry Ocampo
 
Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)Php, mysq lpart4(processing html form)
Php, mysq lpart4(processing html form)
Subhasis Nayak
 
Cinematic UX Design
Cinematic UX DesignCinematic UX Design
Cinematic UX Design
Dave Kelleher
 
HTML validation, microformats, jQuery
HTML validation, microformats, jQueryHTML validation, microformats, jQuery
HTML validation, microformats, jQuery
Jeffrey Barke
 
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
 
Knolx j query-form-validation-slides
Knolx j query-form-validation-slidesKnolx j query-form-validation-slides
Knolx j query-form-validation-slides
Knoldus Inc.
 
jQuery
jQueryjQuery
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
pauljadam
 
LAMP Management with Virtualmin
LAMP Management with VirtualminLAMP Management with Virtualmin
LAMP Management with VirtualminJoe Ferguson
 
jQuery Plugins Intro
jQuery Plugins IntrojQuery Plugins Intro
jQuery Plugins IntroCasey West
 
Apache Web Server Setup 2
Apache Web Server Setup 2Apache Web Server Setup 2
Apache Web Server Setup 2
Information Technology
 
Scalable Internet Servers and Load Balancing
Scalable Internet Servers and Load BalancingScalable Internet Servers and Load Balancing
Scalable Internet Servers and Load BalancingInformation Technology
 
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
LearnNowOnline
 
SydPHP Security in PHP
SydPHP Security in PHPSydPHP Security in PHP
SydPHP Security in PHP
Allan Shone
 
Web Security
Web SecurityWeb Security
Web Security
Rene Churchill
 

Viewers also liked (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
 

Similar to Cross platform php

Intro tounix (1)
Intro tounix (1)Intro tounix (1)
Intro tounix (1)
Raj Mirje
 
Intro to linux
Intro to linuxIntro to linux
Intro to linux
Ravi Prakash Giri
 
Linux
LinuxLinux
linux.pdf
linux.pdflinux.pdf
linux.pdf
jhon508183
 
Linux introduction (eng)
Linux introduction (eng)Linux introduction (eng)
Linux introduction (eng)
Anatoliy Okhotnikov
 
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 tounixdjprince
 
Unix Administration 1
Unix Administration 1Unix Administration 1
Unix Administration 1
Information Technology
 
IntroToUnix.ppt
IntroToUnix.pptIntroToUnix.ppt
IntroToUnix.ppt
Pecific University
 
IntroToUnix.ppt.intro.to.linuxlinuxintroduction
IntroToUnix.ppt.intro.to.linuxlinuxintroductionIntroToUnix.ppt.intro.to.linuxlinuxintroduction
IntroToUnix.ppt.intro.to.linuxlinuxintroduction
NagavelliMadhavi
 
Linux
Linux Linux
Linux
Teja Babu
 
84640411 study-of-unix-os
84640411 study-of-unix-os84640411 study-of-unix-os
84640411 study-of-unix-os
homeworkping3
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
sureskal
 
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
Sagar Kumar
 
Linux Operating System
Linux Operating SystemLinux Operating System
Linux Operating System
Avnish Khandelwal
 
Linux
LinuxLinux

Similar to 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
 

More from Elizabeth Smith

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

More from 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
 

Recently uploaded

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 

Recently uploaded (20)

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 

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