Wieder so ein "mal eben" Projekt: ein aktuelles
PHPUnit unter
XAMPP für Windows installieren. Nun ist
PEAR nicht gerade meine Welt, aber das hatte leider nichts mehr mit "mal eben" zu tun. Die Fehlermeldung mit der ich nichts anfangen konnte war:
SECURITY ERROR: package in channel "pear.symfony-project.com" retrieved another channel's name for download! ("pear.php.net")
Nach ungezählten, erfolglosen Versuchen hat es dann schliesslich doch noch mit dem PHPUnit geklappt ...
PHPUnit unter XAMPP für Windows - Step by Step Installation
Da selbst die heute aktuelle XAMPP für Windows Verison (v1.7.4-VC6) eine inzwischen veraltete PEAR Version enthält, muss dies nach der XAMPP Installation zuerst mal aktualisiert werden, bevor man überhaupt mit PHPUnit beginnen kann.
Installation XAMPP für Windows
Der Schritt ist noch der einfachste überhaupt.
XAMPP herunterladen und installieren - fertig. (Auch mit meinem Windows 7 Professional 64bit.) Ich habe für die Installation nicht das Standardverzeichnis gewählt, sondern "E:\xampp". Das spielt bei der PEAR Konfiguration gleich noch eine Rolle.
System.- bzw. Umgebungsvariablen hinzufügen/ändern
Es wird vorgeschlagen der Systemvariablen "PATH" den Pfad zur PHP Installation mit anzugeben. Des weiteren habe ich den Pfad zur pear.ini gesetzt, damit die Konfiguration nicht in den "Untiefen der Windows 7 Benzuterverzeichnisse" versinkt

.
Systemsteuerung » System und Sicherheit » System » Erweiterte Systemeinstellungen
Bei PATH noch ";E:\xampp\php" (ohne Anführungszeichen) anhängen. Als Umgebungsvariable den Wert PHP_PEAR_SYSCONF_DIR mit dem Wert "e:\xampp\php" anlegen.
E:\xampp\php>pear -V
PEAR Version: 1.7.2
PHP Version: 5.3.5
Zend Engine Version: 2.3.0
Leider ist die PEAR Version etwas veraltet. Aktuell ist die 1.9.2 ...
PEAR konfigurieren und aktualisieren
PEAR config Pfade angepassen
Leider sind nicht alle Pfade richtig gesetzt und müssen angepasst werden:
E:\xampp\php>pear config-show
CONFIGURATION (CHANNEL PEAR.PHP.NET):
=====================================
Auto-discover new Channels auto_discover
Default Channel default_channel pear.php.net
HTTP Proxy Server Address http_proxy
PEAR server [DEPRECATED] master_server pear.php.net
Default Channel Mirror preferred_mirror pear.php.net
Remote Configuration File remote_config
PEAR executables directory bin_dir E:\xampp\php
PEAR documentation directory doc_dir C:\php\pear\docs
PHP extension directory ext_dir E:\xampp\php\ext
PEAR directory php_dir E:\xampp\php\pear
PEAR Installer cache directory cache_dir C:\Users\Mike\AppData\Local\Temp\pear\cache
PEAR configuration file cfg_dir C:\php\pear\cfg
directory
PEAR data directory data_dir C:\php\pear\data
PEAR Installer download download_dir C:\Users\Mike\AppData\Local\Temp\pear\download
directory
PHP CLI/CGI binary php_bin E:\xampp\php\.\php.exe
php.ini location php_ini
PEAR Installer temp directory temp_dir C:\Users\Mike\AppData\Local\Temp\pear\temp
PEAR test directory test_dir C:\php\pear\tests
PEAR www files directory www_dir C:\php\pear\www
Cache TimeToLive cache_ttl 3600
Preferred Package State preferred_state stable
Unix file mask umask 0
Debug Log Level verbose 1
PEAR password (for password
maintainers)
Signature Handling Program sig_bin C:\Program Files
(x86)\GNU\GnuPG\pub\gpg.EXE
Signature Key Directory sig_keydir e:\xampp\php\pearkeys
Signature Key Id sig_keyid
Package Signature Type sig_type gpg
PEAR username (for username
maintainers)
User Configuration File Filename e:\xampp\php\pear.ini
System Configuration File Filename e:\xampp\php\pearsys.ini
Ich habe die Dateien dann wie folgt geändert:
pear config-set doc_dir E:\xampp\php\docs
pear config-set cache_dir E:\xampp\php\tmp
pear config-set cfg_dir E:\xampp\php\cfg
pear config-set data_dir E:\xampp\php\data
pear config-set download_dir E:\xampp\php\tmp
pear config-set temp_dir E:\xampp\php\tmp
pear config-set test_dir E:\xampp\php\tests
pear config-set www_dir E:\xampp\php\www
Defekte go-pear.phar erneuern
Hier fingen dann schon die ersten Schwierigkeiten an. Beim Ausführen von go-pear.bat wurden endlos viele "deprecated" Warnung angezeigt. Bei
stackoverflow dann der rettende Hinweis: die go-pear.phar Datei in XAMPP Paket ist korrupt. Die Datei auch viel zu klein. Eine aktuelle Version von go-bear.phar gibt es hier:
http://pear.php.net/go-pear.phar
go-pear.bat ausführen
Are you installing a system-wide PEAR or a local copy?
(system|local)
Diese Frage habe ich mit local beantwortet ... Das Ergebnis sollte dann in etwa so aussehen:
Beginning install...
Configuration written to E:\xampp\php\pear.ini...
Initialized registry...
Preparing to install...
installing phar://E:/xampp/php/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar...
installing phar://E:/xampp/php/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar...
installing phar://E:/xampp/php/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.2.tar...
installing phar://E:/xampp/php/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar...
installing phar://E:/xampp/php/PEAR/go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar...
install ok: channel://pear.php.net/Archive_Tar-1.3.7
install ok: channel://pear.php.net/Console_Getopt-1.3.0
install ok: channel://pear.php.net/Structures_Graph-1.0.4
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
** WARNING! Old version found at E:\xampp\php, please remove it or be sure to us
e the new e:\xampp\php\pear.bat command
The 'pear' command is now at your service at e:\xampp\php\pear.bat
Drücken Sie eine beliebige Taste . . .
Ok, das sieht nun schon besser aus:
pear -V
PEAR Version: 1.9.2
PHP Version: 5.3.5
Zend Engine Version: 2.3.0
Die PHPUnit Installation
Vor der PHPUnit Installation steht das bekannt machen der channels:
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
und dann:
pear install phpunit/PHPUnit
und nix mehr geht ...
Fehler bei der PHPUnit Installation
Notice: unserialize(): Error at offset 0 of 99 bytes in PEAR\REST\10.php on line
288
PHP Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\P
EAR\REST\10.php on line 288
Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\PEAR\R
EST\10.php on line 288
SECURITY ERROR: package in channel "pear.symfony-project.com" retrieved another
channel's name for download! ("pear.php.net")
Notice: unserialize(): Error at offset 0 of 99 bytes in PEAR\REST\10.php on line
288
PHP Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\P
EAR\REST\10.php on line 288
Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\PEAR\R
EST\10.php on line 288
SECURITY ERROR: package in channel "pear.symfony-project.com" retrieved another
channel's name for download! ("pear.php.net")
Did not download optional dependencies: ezc/ConsoleTools, use --alldeps to downl
oad automatically
phpunit/PHPUnit requires package "symfony/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "curl"
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/DbUnit requires package "symfony/YAML" (version >= 1.0.2)
phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2
.0.5)
downloading File_Iterator-1.2.6.tgz ...
Starting to download File_Iterator-1.2.6.tgz (3,439 bytes)
....done: 3,439 bytes
downloading Text_Template-1.1.0.tgz ...
Starting to download Text_Template-1.1.0.tgz (2,783 bytes)
...done: 2,783 bytes
downloading PHP_CodeCoverage-1.0.4.tgz ...
Starting to download PHP_CodeCoverage-1.0.4.tgz (115,029 bytes)
...done: 115,029 bytes
downloading PHP_Timer-1.0.0.tgz ...
Starting to download PHP_Timer-1.0.0.tgz (2,536 bytes)
...done: 2,536 bytes
downloading PHPUnit_MockObject-1.0.8.tgz ...
Starting to download PHPUnit_MockObject-1.0.8.tgz (18,199 bytes)
...done: 18,199 bytes
downloading PHPUnit_Selenium-1.0.2.tgz ...
Starting to download PHPUnit_Selenium-1.0.2.tgz (16,412 bytes)
...done: 16,412 bytes
downloading PHP_TokenStream-1.0.1.tgz ...
Starting to download PHP_TokenStream-1.0.1.tgz (7,250 bytes)
...done: 7,250 bytes
downloading ConsoleTools-1.6.1.tgz ...
Starting to download ConsoleTools-1.6.1.tgz (869,994 bytes)
...done: 869,994 bytes
downloading Base-1.8.tgz ...
Starting to download Base-1.8.tgz (236,357 bytes)
...done: 236,357 bytes
install ok: channel://pear.phpunit.de/File_Iterator-1.2.6
install ok: channel://pear.phpunit.de/Text_Template-1.1.0
install ok: channel://pear.phpunit.de/PHP_Timer-1.0.0
install ok: channel://pear.phpunit.de/PHPUnit_Selenium-1.0.2
install ok: channel://components.ez.no/Base-1.8
install ok: channel://pear.phpunit.de/PHPUnit_MockObject-1.0.8
install ok: channel://components.ez.no/ConsoleTools-1.6.1
install ok: channel://pear.phpunit.de/PHP_TokenStream-1.0.1
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-1.0.4
OK, nix stimmt nicht so ganz.

Zuerst die Notice Meldungen, dann ein Security Error und noch 2x der Hinweis, das ein Paket PHPUnit bzw. DBUnit wegen einer Abhängigkeit von dem package "symfony/YAML" nicht installiert wird.
Nur was besagt der Security Error aus? Wie bekommt man das symfony/YAML vielleicht doch noch installiert?
Die Rettung -> Installation per URI
Alle Versuche das Paket symfony/YAML per PEAR - Paket zu installieren schlugen fehl. Der wichtige Hinweis stammt von
"buggybunny" vom hackerboard.de. Scheinbar blockiert irgend etwas die Installation von symfony-project.com und in Folge dessen kommt der Fehler. Unter
http://pear.symfony-project.com/ bekommt man den aktuellsten Download angeboten.
pear install http://pear.symfony-project.com//get/YAML-1.0.5.tgz
downloading YAML-1.0.5.tgz ...
Starting to download YAML-1.0.5.tgz (9,966 bytes)
.....done: 9,966 bytes
install ok: channel://pear.symfony-project.com/YAML-1.0.5
Nun kommt auch ein aktuelles PHPUnit
Nach dem nun der gordische Knoten zerschlagen wurde, funktioniert auch die PHPUnit Installation!
E:\xampp\php>pear install phpunit/PHPUnit
Notice: unserialize(): Error at offset 0 of 99 bytes in PEAR\REST\10.php on line
288
PHP Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\P
EAR\REST\10.php on line 288
Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\PEAR\R
EST\10.php on line 288
SECURITY ERROR: package in channel "pear.symfony-project.com" retrieved another
channel's name for download! ("pear.php.net")
Notice: unserialize(): Error at offset 0 of 99 bytes in PEAR\REST\10.php on line
288
PHP Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\P
EAR\REST\10.php on line 288
Notice: unserialize(): Error at offset 0 of 99 bytes in E:\xampp\php\PEAR\PEAR\R
EST\10.php on line 288
SECURITY ERROR: package in channel "pear.symfony-project.com" retrieved another
channel's name for download! ("pear.php.net")
phpunit/PHPUnit can optionally use PHP extension "curl"
phpunit/PHPUnit can optionally use PHP extension "dbus"
downloading PHPUnit-3.5.13.tgz ...
Starting to download PHPUnit-3.5.13.tgz (118,553 bytes)
..........................done: 118,553 bytes
downloading DbUnit-1.0.1.tgz ...
Starting to download DbUnit-1.0.1.tgz (39,055 bytes)
...done: 39,055 bytes
install ok: channel://pear.phpunit.de/DbUnit-1.0.1
install ok: channel://pear.phpunit.de/PHPUnit-3.5.13
E:\xampp\php>phpunit -V
PHPUnit 3.5.13 by Sebastian Bergmann.
Haleluja!
Wofür überhaupt die Arbeit? Wie geht es weiter?
Die kommenden Projekte sollen auch mit automatischen Unittest (PHPUnit für PHP) entwickelt werden. An TDD denke ich noch nicht mal, aber man kann ja mal klein starten. Für heute reicht es mir. In den nächsten Tagen gibt dann noch einen Beitrag über die ersten Schritte mit PHPUnit und der IDE Netbeans.
Auf meinen Artikel zu PHPUnit und XAMPP hatte sich Christian Lenz bei mir gemeldet. Er hatte auch noch Schwierigkeiten, hat es aber dann noch unter MoWeS (statt XAMPP) zum Laufen gebracht. Er war so freundlich mir sein "PHPUnit Tutorial" zuzusenden damit
Aufgenommen: Jun 03, 17:43