29
PHP INTERNALS ON WINDOWS Pierre Joye vortrag@mayflower 2009/10/22 easier than ever

Php On Windows Internals

Embed Size (px)

DESCRIPTION

Intro to develop PHP and PHP extensions on Windows. Basic steps to setup a development environment or to hunt down bugs,

Citation preview

Page 1: Php On Windows Internals

PHP INTERNALS ON WINDOWS

Pierre Joyevortrag@mayflower2009/10/22

easier than ever

Page 2: Php On Windows Internals

Get in touch

http://twitter.com/pierrejoye

http://www.facebook.com/pierre.joye

http://www.linkedin.com/in/pierrejoye

http://www.xing.com/profile/Pierre_Joye

[email protected]

Page 3: Php On Windows Internals

Why Windows?

Portability

Customers Need

Interop

Do it yourself

Page 4: Php On Windows Internals

INTRODUCTIONHow did we get here?

Page 5: Php On Windows Internals

MOTIVATIONSWhy it is worth doing

Page 6: Php On Windows Internals

Support

IRC Freenode#php-dev-win

Windows Internals listhttp://www.php.net/mailing-lists.php

http://wiki.php.net/internals/windows

Page 7: Php On Windows Internals

STARTING OUTWhat do you need to get started

Page 8: Php On Windows Internals

Prerequisites

Page 9: Php On Windows Internals

Supported Platformsx86

Windows Server 2008

Windows 7

Windows Server 2003

Windows Vista

Windows XP (SP2+)

Page 10: Php On Windows Internals

Compilersx86

Visual Studio 2010

Visual Studio 2008

Visual Studio 2005

Visual Studio 2003

Visual Studio 6

Page 11: Php On Windows Internals

Platform SDKx86

Platform SDK 7.0

Platform SDK 6.1

Platform SDK 2003/02

Other

Page 12: Php On Windows Internals

Works but not used in php.net releases

5.2 5.3 6.0Visual Studio 2010

Visual Studio 2008

Visual Studio 2005

Visual Studio2003

Visual Studio 6

Versions used by php.net

Works and used in php.net releases

No support

Page 13: Php On Windows Internals

All you need is a console

Setup a default debugging environment for 32bitsetenv /x86 /xp /debug (yellow)setenv /x86 /xp /release (green)

Page 14: Php On Windows Internals

BUILDING PHPA custom build in 10 minutes

Page 15: Php On Windows Internals

Setup your tree

Page 16: Php On Windows Internals

Common tree contents

• Architecture specific commands• dlls

bin

• Headers files

include

• Development libraries (.lib, known as .a on unix platforms)

lib

Page 17: Php On Windows Internals

Get the sourcesSVN

http://www.php.net/svn.phpSnapshots

http://windows.php.net/snapshots/Releases

http://windows.php.net/releases/

Page 18: Php On Windows Internals

Generate the configuration scripts

Add a custom extension directory (pecl, your own extensions, etc.)Buildconf --add-modules-dir=c:\path\to\pecl

Page 19: Php On Windows Internals

Configure your build

Page 20: Php On Windows Internals

Compiling

Page 21: Php On Windows Internals

AUDIENCE PARTICIPATION

Can you build it?

Page 22: Php On Windows Internals

Typical Structure of a development package

Page 23: Php On Windows Internals

Test FCGI in the console

set REDIRECT_STATUS=1set QUERY_STRING=set PATH_TRANSLATED=C:\Inetpub\wwwroot\inf.phpset SCRIPT_FILENAME=C:\Inetpub\wwwroot\inf.phpset REQUEST_METHOD=GETset CONTENT_TYPE=set CONTENT_LENGTH=

Page 24: Php On Windows Internals

Want to add a feature?

Define the dependenc

ies

•http://wiki.php.net/internals/windows/libs

Download the

required Zip

•http://pecl2.php.net/downloads/php-windows-builds/php-libs/VC9/x86/

Unpack

•Unzip in your deps directory

Page 25: Php On Windows Internals

My code has no bug

Page 26: Php On Windows Internals

Breakpoints, the easy way

Page 27: Php On Windows Internals

THE FUTUREWhat‘s next?

Page 28: Php On Windows Internals

QUESTIONS?Answers.

Page 29: Php On Windows Internals

Resources

http://sourceforge.net/projects/console/

http://sliksvn.com

http://tortoisesvn.tigris.org/

http://pecl2.php.net/downloads/php-windows-builds/php-libs/binary-tools.zip

http://www.microsoft.com/express/

http://windows.php.net

http://wiki.php.net/internals/windows/

http://wiki.php.net/internals/windows/stepbystepbuild