SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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 betterZendCon
 
Php on the Web and Desktop
Php on the Web and DesktopPhp on the Web and Desktop
Php on the Web and DesktopElizabeth Smith
 
Programming in Computational Biology
Programming in Computational BiologyProgramming in Computational Biology
Programming in Computational BiologyAtreyiB
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien 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 extensionjulien pauli
 
Unit 1-introduction to perl
Unit 1-introduction to perlUnit 1-introduction to perl
Unit 1-introduction to perlsana 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
 
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 BasicsNina Zakharenko
 
New Features in PHP 5.3
New Features in PHP 5.3New Features in PHP 5.3
New Features in PHP 5.3Bradley Holt
 

Tendances (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
 

En vedette

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
 
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
 
HTML validation, microformats, jQuery
HTML validation, microformats, jQueryHTML validation, microformats, jQuery
HTML validation, microformats, jQueryJeffrey 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-slidesKnoldus Inc.
 
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 Validationpauljadam
 
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
 
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 jQueryLearnNowOnline
 
SydPHP Security in PHP
SydPHP Security in PHPSydPHP Security in PHP
SydPHP Security in PHPAllan Shone
 

En vedette (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
 

Similaire à 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
 
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
 
Programming and problem solving 3
Programming and problem solving 3Programming and problem solving 3
Programming and problem solving 3
 

Plus de Elizabeth Smith

Plus 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
 

Dernier

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Dernier (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

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