SlideShare a Scribd company logo
1 of 21
Download to read offline
Compiling PHP
                      on
                    Windows


A quick about myself, what I do, who I am, and then on with the show
The World of Windows



Warn that this is not for people who have never compiled before, some basic compiling
knowledge of C is required - start by taking a look at how windows is a different beast.
Binaries on Windows
    • Executables
        *.exe Actual binary to invoke


    • Dynamic Load Libraries
        *.dll Hold additional functions to perform, can be loaded dynamically
        Just to be confusing, this uses *.lib extension


    • Static Libraries
        *.lib Contain all the code to perform but are permanently linked into executables or
        dynamic link libaries

    •   Binaries should be relocatable by default on windows!




No way to tell between static library and stub library for dll (except size and some naming
convention) .dlls equivalent to .so, static libraries are equivalent to .a
Types of PHP Builds

   • Release
   • Release_TS
   • Debug
   • Debug_TS



                                            4

Can’t mix TS (thread safe) and nts (non-thread safe) - can’t mix debug and non-debug
Runtime Mayhem
           • MSVCRT.dll

           • MSVCR70.dll

           • MSVCR71.dll

           • MSVCR80.dll

           • MSVCR90.dll

To make things really confusing, MS has different versions of their microsoft visual c runtime,
the regular on is standard, the 90 is shipped with vista...the rest you have to distribute
Why build it?



Reasons and situations where you’d build on windows, after all it is a pain. Warn that this is
not for people who have never compiled before, some basic compiling knowledge of C is
required
Binaries are Provided
   • http://php.net/download
   • http://snaps.php.net
   • http://pecl4win.php.net
   • http://kromann.info/php.php
   • http://www.apachelounge.com/download/
   • http://perisama.net/downloads

                                             7

The first three here provide “official” binaries, all are build with MSVC6 and use a mingw
compatible runtime. Kromann provides .libs but not debug packs and builds with MSVC7
thread safe but provides the most php versions, apache lounge provides apache binaries only
and is MSVC8 thread safe, Perisama provides all four versions, libs, and debug packs and
does it on three compilers, however it only does pecl cvs and php current release
Cool things from
                     binary builds
      • .pdb (debug symbols) will make life
        easier - get the windows ones too
          http://www.microsoft.com/whdc/devtools/debugging/
          debugstart.mspx


      • .lib (library files) can be used to build
        extensions without building the whole
        mess
      *Remember you can’t mix compilers/runtimes and expect no explosions*


debug packs let you use windbg to debug your extensions (not discussed much here, but
useful), you can’t mix compiler stuff and expect things to NOT blow up. Usually you can use
older libs with the newer runtimes but not always! You can link against “stock” php or snap
builds using the lib files and avoid building the kit and caboodle
Just not enough...




However, sometimes you want to do special junk (like I needed built in gd for php-gtk2 for
awhile) and stock builds just won’t cut it
Setting things Up



You need a compile environment before you can get started
Windows Compilers
                                                   • Microsoft Visual Studio

                                                   • MinGW

                                                   • Intel Compilers

                                                   • Borland

                                                   • Cygwin

                                                   • Many More
                                                       http://willus.com/ccomp.shmtl


Intel is usually the fastest, but uses MSVC libraries and headers, MVSC ranks next, followed
by mingw (gcc underneath) and borland. Cygwin is slow and has a layer in between to fake
posix. The willus website has a ton of benchmarks and other compilers, although it’s slightly
out of date. Anway, PHP can only be built with MSVC or cygwin, other compilers aren’t
supported yet.
Visual Studio Runtimes...
        • MSVC6 - MSVCRT.dll

        • MINGW with --mms-bitfields (same)

        • MSVC .NET - MSVCR71.dll

        • MSVC 2005 - MSVCR80.dll

        • Orcas (MSVC 2008 Beta) - MSVCR90.dll
            (shipped with Vista)



Now that you all have a headache... usually you can use older libs with newer libs (always
mix down not up) but weird, unreproduceable crashes are known to happen. So know your
target.
The gold standard
    • MSVC6 is still standard
    • Builds against mingw stuff
    • Apply service packs!
    • Use newer nmake, but old cli and link
    • Use newer SDK from
        http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm




it’s also old, slow, ugly, and a pain to find and get set up right, not recommended
What Else Works
           • Visual Studio .NET (2003 Version)

           • Visual Studio 2005

           • Visual Studio 2008

           • Visual C++ Express - works with
             annoying setup




2005 or C++ Express 2005 are your best bets, although a warning, apache hates runtime
mixing, so build apache too if you intend to use 2005 on apache, cgi and cli doesn’t matter
Free is Good
   • Install C++ Express
        http://msdn2.microsoft.com/en-us/express/aa700735.aspx


   • Install Platform SDK
         http://www.microsoft.com/downloads/details.aspx?familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb



   • Integrate them using the instructions
        http://msdn2.microsoft.com/en-us/express/aa700755.aspx




warning - the sdk is enormous, like several gig, so be prepared for a heck of a download,
make sure to edit the paths in your command line stuff since you’ll be using that too
Getting Ready to Build



You need more than just a working compiler to get php building
Required Tools

                        • Compile Environment

                        • PHP Source

                        • Command Line Tools

                        • Headers and Libraries




You’ll need a compile environment, PHP source code from cvs, a snap, or a download, some
command line tools, and headers and libraries that php depends on in order to build
Configuration

        • Gcc uses automagic stuff

        • Visual Studio uses Project Files (not as
          flexible)

        • PHP uses a command line configure
          run by cscript, written in jscript




cscript is a pretty nifty tool, and the php command line stuff is pretty flexible, however at this
point there isn’t (yet) a way to handle “phpize” and build against an existing php with the
build system (really annoying...) - it’s on my todo list
Edin’s Treasure Trove
  • PHP uses specialized builds of several libraries

  • The download pointed to at the php.net manual has
    incorrect libraries

  • Additional “Unixy” tools are required in PATH

  • You can get what you need in one spot...but it’s HUGE
      http://files.edin.dk/php/win32/zip.zip




Complain about the new bison requirement, tell people to put the tools in their path
somehow, warn that the file is big and slow, grump about standarized windows binaries
sucking and are always old
Ready to finally build?
           • This is command line, cmd.exe is your
             friend

           • Use your compile environment’s batch
             file shortcut

           • Are your additional tools in your
             PATH? Easy way to do this is write a
             batch file that does it all



just a quick are you ready to go? checklist
Time to Reboot



Let’s move to windows XP and do some compiling

More Related Content

What's hot

Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objectsjulien pauli
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09Elizabeth Smith
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaCosimo Streppone
 
Mojo – Simple REST Server
Mojo – Simple REST ServerMojo – Simple REST Server
Mojo – Simple REST Serverhendrikvb
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Adam Tomat
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统yiditushe
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11Elizabeth Smith
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoojeresig
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotClouddaoswald
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsEnrico Zimuel
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHPDavid de Boer
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentationAnnujj Agrawaal
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Bastian Feder
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodesnihiliad
 

What's hot (20)

Understanding PHP objects
Understanding PHP objectsUnderstanding PHP objects
Understanding PHP objects
 
SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09SPL to the Rescue - Tek 09
SPL to the Rescue - Tek 09
 
How we use and deploy Varnish at Opera
How we use and deploy Varnish at OperaHow we use and deploy Varnish at Opera
How we use and deploy Varnish at Opera
 
Mojo – Simple REST Server
Mojo – Simple REST ServerMojo – Simple REST Server
Mojo – Simple REST Server
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018Supercharging WordPress Development in 2018
Supercharging WordPress Development in 2018
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
Writing and using php streams and sockets tek11
Writing and using php streams and sockets   tek11Writing and using php streams and sockets   tek11
Writing and using php streams and sockets tek11
 
The DOM is a Mess @ Yahoo
The DOM is a Mess @ YahooThe DOM is a Mess @ Yahoo
The DOM is a Mess @ Yahoo
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 
Anatomy of a reusable module
Anatomy of a reusable moduleAnatomy of a reusable module
Anatomy of a reusable module
 
Deploying Perl apps on dotCloud
Deploying Perl apps on dotCloudDeploying Perl apps on dotCloud
Deploying Perl apps on dotCloud
 
Zend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applicationsZend_Cache: how to improve the performance of PHP applications
Zend_Cache: how to improve the performance of PHP applications
 
Debugging on rails
Debugging on railsDebugging on rails
Debugging on rails
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
HTTP Caching and PHP
HTTP Caching and PHPHTTP Caching and PHP
HTTP Caching and PHP
 
Django in the Real World
Django in the Real WorldDjango in the Real World
Django in the Real World
 
PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009Eclipse Pdt2.0 26.05.2009
Eclipse Pdt2.0 26.05.2009
 
Auto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK NodesAuto-loading of Drupal CCK Nodes
Auto-loading of Drupal CCK Nodes
 

Similar to Php on Windows

Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5David Voyles
 
Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Molliewillemstuursma
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to DockerAlan Forbes
 
C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserAndre Weissflog
 
Unikernel User Summit 2015: Getting started in unikernels using the rump kernel
Unikernel User Summit 2015: Getting started in unikernels using the rump kernelUnikernel User Summit 2015: Getting started in unikernels using the rump kernel
Unikernel User Summit 2015: Getting started in unikernels using the rump kernelThe Linux Foundation
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...Gaetano Giunta
 
PHP, Cloud And Microsoft Symfony Live 2010
PHP,  Cloud And  Microsoft    Symfony  Live 2010PHP,  Cloud And  Microsoft    Symfony  Live 2010
PHP, Cloud And Microsoft Symfony Live 2010guest5a7126
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Railselliando dias
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNicola Del Gobbo
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Codemotion
 
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Adam Dunkels
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & howdotCloud
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
Development with Qt for Windows CE
Development with Qt for Windows CEDevelopment with Qt for Windows CE
Development with Qt for Windows CEaccount inactive
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
 
321 codeincontainer brewbox
321 codeincontainer brewbox321 codeincontainer brewbox
321 codeincontainer brewboxLino Telera
 

Similar to Php on Windows (20)

Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
Getting started with Emscripten – Transpiling C / C++ to JavaScript / HTML5
 
Continuous Integration at Mollie
Continuous Integration at MollieContinuous Integration at Mollie
Continuous Integration at Mollie
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
C++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browserC++ on the Web: Run your big 3D game in the browser
C++ on the Web: Run your big 3D game in the browser
 
Unikernel User Summit 2015: Getting started in unikernels using the rump kernel
Unikernel User Summit 2015: Getting started in unikernels using the rump kernelUnikernel User Summit 2015: Getting started in unikernels using the rump kernel
Unikernel User Summit 2015: Getting started in unikernels using the rump kernel
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
eZ Publish 5: from zero to automated deployment (and no regressions!) in one ...
 
PHP, Cloud And Microsoft Symfony Live 2010
PHP,  Cloud And  Microsoft    Symfony  Live 2010PHP,  Cloud And  Microsoft    Symfony  Live 2010
PHP, Cloud And Microsoft Symfony Live 2010
 
The Architect Way
The Architect WayThe Architect Way
The Architect Way
 
RubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on RailsRubyStack: the easiest way to deploy Ruby on Rails
RubyStack: the easiest way to deploy Ruby on Rails
 
Presentation1.pptx
Presentation1.pptxPresentation1.pptx
Presentation1.pptx
 
Nodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to heroNodejs Native Add-Ons from zero to hero
Nodejs Native Add-Ons from zero to hero
 
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
Node.js Native AddOns from zero to hero - Nicola Del Gobbo - Codemotion Rome ...
 
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Development with Qt for Windows CE
Development with Qt for Windows CEDevelopment with Qt for Windows CE
Development with Qt for Windows CE
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
321 codeincontainer brewbox
321 codeincontainer brewbox321 codeincontainer brewbox
321 codeincontainer brewbox
 
Nodejs overview
Nodejs overviewNodejs overview
Nodejs overview
 

More from Elizabeth 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
 
Hacking with hhvm
Hacking with hhvmHacking with hhvm
Hacking with hhvm
 
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
 

Recently uploaded

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
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
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
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
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
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)
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
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.
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Php on Windows

  • 1. Compiling PHP on Windows A quick about myself, what I do, who I am, and then on with the show
  • 2. The World of Windows Warn that this is not for people who have never compiled before, some basic compiling knowledge of C is required - start by taking a look at how windows is a different beast.
  • 3. Binaries on Windows • Executables *.exe Actual binary to invoke • Dynamic Load Libraries *.dll Hold additional functions to perform, can be loaded dynamically Just to be confusing, this uses *.lib extension • Static Libraries *.lib Contain all the code to perform but are permanently linked into executables or dynamic link libaries • Binaries should be relocatable by default on windows! No way to tell between static library and stub library for dll (except size and some naming convention) .dlls equivalent to .so, static libraries are equivalent to .a
  • 4. Types of PHP Builds • Release • Release_TS • Debug • Debug_TS 4 Can’t mix TS (thread safe) and nts (non-thread safe) - can’t mix debug and non-debug
  • 5. Runtime Mayhem • MSVCRT.dll • MSVCR70.dll • MSVCR71.dll • MSVCR80.dll • MSVCR90.dll To make things really confusing, MS has different versions of their microsoft visual c runtime, the regular on is standard, the 90 is shipped with vista...the rest you have to distribute
  • 6. Why build it? Reasons and situations where you’d build on windows, after all it is a pain. Warn that this is not for people who have never compiled before, some basic compiling knowledge of C is required
  • 7. Binaries are Provided • http://php.net/download • http://snaps.php.net • http://pecl4win.php.net • http://kromann.info/php.php • http://www.apachelounge.com/download/ • http://perisama.net/downloads 7 The first three here provide “official” binaries, all are build with MSVC6 and use a mingw compatible runtime. Kromann provides .libs but not debug packs and builds with MSVC7 thread safe but provides the most php versions, apache lounge provides apache binaries only and is MSVC8 thread safe, Perisama provides all four versions, libs, and debug packs and does it on three compilers, however it only does pecl cvs and php current release
  • 8. Cool things from binary builds • .pdb (debug symbols) will make life easier - get the windows ones too http://www.microsoft.com/whdc/devtools/debugging/ debugstart.mspx • .lib (library files) can be used to build extensions without building the whole mess *Remember you can’t mix compilers/runtimes and expect no explosions* debug packs let you use windbg to debug your extensions (not discussed much here, but useful), you can’t mix compiler stuff and expect things to NOT blow up. Usually you can use older libs with the newer runtimes but not always! You can link against “stock” php or snap builds using the lib files and avoid building the kit and caboodle
  • 9. Just not enough... However, sometimes you want to do special junk (like I needed built in gd for php-gtk2 for awhile) and stock builds just won’t cut it
  • 10. Setting things Up You need a compile environment before you can get started
  • 11. Windows Compilers • Microsoft Visual Studio • MinGW • Intel Compilers • Borland • Cygwin • Many More http://willus.com/ccomp.shmtl Intel is usually the fastest, but uses MSVC libraries and headers, MVSC ranks next, followed by mingw (gcc underneath) and borland. Cygwin is slow and has a layer in between to fake posix. The willus website has a ton of benchmarks and other compilers, although it’s slightly out of date. Anway, PHP can only be built with MSVC or cygwin, other compilers aren’t supported yet.
  • 12. Visual Studio Runtimes... • MSVC6 - MSVCRT.dll • MINGW with --mms-bitfields (same) • MSVC .NET - MSVCR71.dll • MSVC 2005 - MSVCR80.dll • Orcas (MSVC 2008 Beta) - MSVCR90.dll (shipped with Vista) Now that you all have a headache... usually you can use older libs with newer libs (always mix down not up) but weird, unreproduceable crashes are known to happen. So know your target.
  • 13. The gold standard • MSVC6 is still standard • Builds against mingw stuff • Apply service packs! • Use newer nmake, but old cli and link • Use newer SDK from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm it’s also old, slow, ugly, and a pain to find and get set up right, not recommended
  • 14. What Else Works • Visual Studio .NET (2003 Version) • Visual Studio 2005 • Visual Studio 2008 • Visual C++ Express - works with annoying setup 2005 or C++ Express 2005 are your best bets, although a warning, apache hates runtime mixing, so build apache too if you intend to use 2005 on apache, cgi and cli doesn’t matter
  • 15. Free is Good • Install C++ Express http://msdn2.microsoft.com/en-us/express/aa700735.aspx • Install Platform SDK http://www.microsoft.com/downloads/details.aspx?familyid=0baf2b35-c656-4969-ace8-e4c0c0716adb • Integrate them using the instructions http://msdn2.microsoft.com/en-us/express/aa700755.aspx warning - the sdk is enormous, like several gig, so be prepared for a heck of a download, make sure to edit the paths in your command line stuff since you’ll be using that too
  • 16. Getting Ready to Build You need more than just a working compiler to get php building
  • 17. Required Tools • Compile Environment • PHP Source • Command Line Tools • Headers and Libraries You’ll need a compile environment, PHP source code from cvs, a snap, or a download, some command line tools, and headers and libraries that php depends on in order to build
  • 18. Configuration • Gcc uses automagic stuff • Visual Studio uses Project Files (not as flexible) • PHP uses a command line configure run by cscript, written in jscript cscript is a pretty nifty tool, and the php command line stuff is pretty flexible, however at this point there isn’t (yet) a way to handle “phpize” and build against an existing php with the build system (really annoying...) - it’s on my todo list
  • 19. Edin’s Treasure Trove • PHP uses specialized builds of several libraries • The download pointed to at the php.net manual has incorrect libraries • Additional “Unixy” tools are required in PATH • You can get what you need in one spot...but it’s HUGE http://files.edin.dk/php/win32/zip.zip Complain about the new bison requirement, tell people to put the tools in their path somehow, warn that the file is big and slow, grump about standarized windows binaries sucking and are always old
  • 20. Ready to finally build? • This is command line, cmd.exe is your friend • Use your compile environment’s batch file shortcut • Are your additional tools in your PATH? Easy way to do this is write a batch file that does it all just a quick are you ready to go? checklist
  • 21. Time to Reboot Let’s move to windows XP and do some compiling