29
http://www.flickr.com/photos/zunami/4738471442/ http://www.flickr.com/photos/zunami/4738471442/ PHP selber bauen PHP selber bauen PHP User Group Frankfurt 31.03.2011 PHP User Group Frankfurt 31.03.2011 Walter Ebert Walter Ebert

PHP selber bauen

Embed Size (px)

Citation preview

Page 1: PHP selber bauen

http://www.flickr.com/photos/zunami/4738471442/http://www.flickr.com/photos/zunami/4738471442/

PHP selber bauenPHP selber bauenPHP User Group Frankfurt 31.03.2011PHP User Group Frankfurt 31.03.2011

Walter EbertWalter Ebert

Page 2: PHP selber bauen

Willkommen bei den anonymen PHPlern

Mein Name ist Walterund ich kompiliere mir PHP selber

Nicht immer,aber immer öfter

Goggler-Handzeigen

Page 3: PHP selber bauen

http://www.flickr.com/photos/zunami/3125589973/http://www.flickr.com/photos/zunami/3125589973/

Page 4: PHP selber bauen

http://php.net/releases/5_3_0.phphttp://php.net/releases/5_3_0.php

Page 5: PHP selber bauen

http://www.php.net/releases/5_3_3.phphttp://www.php.net/releases/5_3_3.php

Page 6: PHP selber bauen

http://derickrethans.nl/distributions-please-dont-cripple-php-or-red-hat-stop-fucking-around.htmlhttp://derickrethans.nl/distributions-please-dont-cripple-php-or-red-hat-stop-fucking-around.html

Page 7: PHP selber bauen

Kompatibilität / Features

Du musst zum Beispiel:● eine alte PHP Version unterstützen● mehrere PHP Versionen bzw.

Konfigurationen testen● proprietäre Extensions nutzen die nur mit

bestimmten PHP Versionen funktionieren● die letzte Entwickler-Version testen (trunk)

PHP4 irgendwer?

Page 8: PHP selber bauen

http://www.flickr.com/photos/mama/94778673/http://www.flickr.com/photos/mama/94778673/

Page 9: PHP selber bauen

./configuremakesudo make install

b

http://www.php.net/downloads.php

Page 10: PHP selber bauen

./configuremakemake testsudo make install

b

Page 11: PHP selber bauen

LinuxUnix

Mac OS XWindows-> benutze einfach die binariesoder wenn man wirklich muss; besuche: http://wiki.php.net/internals/windows/stepbystepbuild

Page 12: PHP selber bauen

sudo apt-get install \automake autoconf gcc \libtool binutils subversion \libxml2-dev libcurl4-dev \libfreetype6-dev libjpeg-dev libpng-dev

Packages fuer debian / ubuntu

\ = escape linebreaks

b

Page 13: PHP selber bauen

./configure --help

Usage: configure [options] [host]Options: [defaults in brackets after descriptions]Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print `checking...' messages --version print the version of autoconf that created conDirectory and file names: --prefix=PREFIX install architecture-independent files in PREF [/usr/local] --exec-prefix=EPREFIX install architecture-dependent files in EPREFI [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/e --sharedstatedir=DIR modifiable architecture-independent data in DI [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/ --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include]

b

Page 14: PHP selber bauen

./configure \--with-apxs2 \--with-mysql=mysqlnd --with-mysqli=mysqlnd \-–with-pdo-mysql=mysqlnd \--with-curl \--with-gd \--with-jpeg-dir=/usr --with-png-dir=/usr \--with-freetype-dir=/usr

Fuer Apache: Sudo apt-get install apache2-prefork-dev

b

Page 15: PHP selber bauen

./configure \--enable-fpm \--with-gettext --enable-zend-multibyte \--enable-mbstring --with-mcrypt \--enable-soap --enable-wddx --with-xsl \--with-curl --with-openssl \--with-zlib-dir=/usr --with-bz2 --enable-zip \--with-gd --with-jpeg-dir=/usr \--with-png-dir=/usr --with-freetype-dir=/usr \ --enable-exif \--with-mysql=mysqlnd --with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--with-pgsql=/usr --with-pdo-pgsql \--without-sqlite --without-sqlite3 \--without-pdo-sqlite \--with-mm=/usr

b

Page 16: PHP selber bauen
Page 17: PHP selber bauen

./configure

...checking whether to build shared libraries... nochecking whether to build static libraries... yes

creating libtoolappending configuration tag "CXX" to libtool

Generating filesupdating cache ./config.cachecreating ./config.statuscreating php5.speccreating main/build-defs.hcreating scripts/phpizecreating scripts/man1/phpize.1creating scripts/php-configcreating scripts/man1/php-config.1creating sapi/cli/php.1creating main/php_config.hcreating main/internal_functions.ccreating main/internal_functions_cli.c+--------------------------------------------------------------------+| License: || This software is subject to the PHP License, available in this || distribution in the file LICENSE. By continuing this installation || process, you are bound by the terms of this license agreement. || If you do not agree with the terms of this license, you must abort || the installation process at this point. |+--------------------------------------------------------------------+

Thank you for using PHP.

b

Page 18: PHP selber bauen

make

/bin/sh /home/walter/Downloads/php-5.3.5/libtool --silent--preserve-dup-deps --mode=compile gcc -Iext/date/lib -Iext/date/-I/home/walter/Downloads/php-5.3.5/ext/date/ -DPHP_ATOM_INC-I/home/walter/Downloads/php-5.3.5/include...lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt -o sapi/cli/phpGenerating phar.phpGenerating phar.pharPEAR package PHP_Archive not installed: generated phar will requirePHP's phar extension be enabled.directorygraphiterator.incdirectorytreeiterator.incclicommand.incinvertedregexiterator.incpharcommand.incphar.inc

Build complete.Don't forget to run 'make test'.

b

Page 19: PHP selber bauen

bmake test

=====================================================================PHP : /home/walter/Downloads/php-5.3.5/sapi/cli/php PHP_SAPI : cliPHP_VERSION : 5.3.5ZEND_VERSION: 2.3.0PHP_OS : Linux - Linux LM-U200 2.6.35-25-generic #44-Ubuntu SMP INI actual : /home/walter/Downloads/php-5.3.5/tmp-php.ini

...

WARNED TEST SUMMARY---------------------------------------------------------------------via [ext/pdo_sqlite/tests/common.phpt]

SQLite PDO Common: Bug #34630 (inserting streams as LOBs)[ext/pdovia [ext/sqlite/tests/pdo/common.phpt]

SQLite2 PDO Common: Bug #34630 (inserting streams as LOBs) [ext/sBug #39863 (file_exists() silently truncates after a null byte) [ext/=====================================================================

You may have found a problem in PHP.We would like to send this report automatically to thePHP QA team, to give us a better understanding of howthe test cases are doing. If you don't want to send itimmediately, you can choose "s" to save the report toa file that you can send us later.Do you want to send this report now? [Yns]:

Page 20: PHP selber bauen

sudo make install

Generating phar.phpGenerating phar.pharPEAR package PHP_Archive not installed: generated phar willdirectorygraphiterator.incdirectorytreeiterator.incclicommand.incinvertedregexiterator.incpharcommand.incphar.incInstalling PHP SAPI module: fpmInstalling PHP CLI binary: /usr/local/bin/...Installing man pages: /usr/local/man/man1/ page: phpize.1 page: php-config.1Installing PEAR environment: /usr/local/lib/php/[PEAR] Archive_Tar - installed: 1.3.7[PEAR] Console_Getopt - installed: 1.2.3[PEAR] Structures_Graph- installed: 1.0.3[PEAR] XML_Util - installed: 1.2.1[PEAR] PEAR - installed: 1.9.1Warning! a PEAR user config file already exists from a previous Wrote PEAR system config file at: /usr/local/etc/pear.confYou may want to add: /usr/local/lib/php to your php.ini include_path/home/walter/Downloads/php-5.3.5/build/shtool install -c ext/phar/phln -s -f /usr/local/bin/phar.phar /usr/local/bin/pharInstalling PDO headers: /usr/local/include/php/ext/pdo/

b

Page 21: PHP selber bauen

sudo cp php.ini-development /usr/local/lib/php.ini

oder

sudo cp php.ini-production /usr/local/lib/php.ini

b

Page 22: PHP selber bauen

bMit der neuesten Entwickler-Version

Entweder:wget http://snaps.php.net/php-trunk-latest.tar.bz2

Oder:svn checkout http://svn.php.net/repository/php/php-src/trunk/ trunk

cd trunk

./buildconf

./configuremakesudo make install

Page 23: PHP selber bauen

Standard aktivierte Extensions

Core ctype date

dom ereg fileinfo

filter hash Iconv

json libxml pcre

PDO pdo_sqlite Phar

posix Reflection session

SimpleXML SPL SQLite

sqlite3 standard tokenizer

xml xmlreader xmlwriter

./configure --disable-simplexml --without-sqlite3

(in php 5.3)

Page 24: PHP selber bauen

Populäre PHP Extensions

● APC, xCache, eAccelerator● Memcache, memcached● Xdebug● PostgreSQL, mongoDB, OCI8, SQLSRV● Sphinx, xapian, mnogosearch, solr● Suhosin

Page 25: PHP selber bauen

PECL

sudo pecl install apc

http://pecl.php.net/

b

Page 26: PHP selber bauen

phpize./configuremakesudo make install

Extensions kompilieren

Phpize gibt es ab php 5.3.6 auch fuer windows

b

Page 27: PHP selber bauen

/usr/local/lib/php.ini

[apc]

extension=apc.so

[xdebug]

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"

b

Page 28: PHP selber bauen

http://de.php.net/manual/de/install.php

Page 29: PHP selber bauen

Walter Ebert Web Development

@wltrd

walterebert.de

blog.walterebert.com

slideshare.net/walterebert

Search Meetup Frankfurt (12.4.)searchmeetupfrankfurt.de