XAMPP 1.7.4でPhingを使おうとしましたが、エラーが出て使えませんでした。
結果として、Phingの再インストールで治りました。
以下に経緯を残しておきます。
環境
- Windows XP SP3
- XAMPP 1.7.4
- PHP 5.3.5
- Phing 2.3.3 (恐らくXAMPPにデフォルトで入っていたもの)
症状
下記のように、ただ”uhouho”とechoするだけの簡単なビルドファイルを実行しようとして、エラーが出ました。
<!-- C:\temp\build.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<project name="FooBar" default="dist">
<target name="dist">
<echo msg="uhouho"></echo>
</target>
</project>
実行結果
$ phing -f C:\temp\build.xml
Buildfile: C:\temp\build.xml
BUILD FAILED
Can't load default task list
Total time: 0.0030 seconds
また、バージョン表示でもエラーが出ました。
$ phing -v
No VERSION.TXT file found; try setting phing.home environment variable.
対処方法
Setting up your workstation for extension development – Joomla! Documentation > No VERSION.TXT Error を参考に、Phingを再インストールしました。
# アンインストール
$ pear uninstall phing/phing
uninstall ok: channel://pear.phing.info/phing-2.3.3
# チャンネルの設定
$ pear channel-discover pear.phing.info
Channel "pear.phing.info" is already initialized
# インストール
$ pear install phing/phing
WARNING: "pear/PEAR_PackageFileManager" is deprecated in favor of "pear/PEAR_PackageFileManager2"
Did not download optional dependencies: phing/phingdocs, pear/VersionControl_Git, phpunit/PHPUnit, pecl/Xdebug, pear/Services_Amazon_S3, pear/HTTP_Request2, channel://pear.pdepend.org/PHP_Depend, channel://pear.phpmd.org/PHP_PMD, phpunit/phpcpd, channel://pear.docblox-project.org/DocBlox, pear/PHP_CodeSniffer, use --alldeps to download automatically
phing/phing requires PEAR Installer (version >= 1.8.0), installed version is 1.7.2
phing/phing can optionally use package "phing/phingdocs" (version >= 2.4.7.1)
phing/phing requires package "pear/VersionControl_SVN" (version >= 0.3.4), installed version is 0.3.1
phing/phing can optionally use package "pear/VersionControl_Git" (version >= 0.4.3)
phing/phing can optionally use package "phpunit/PHPUnit" (version >= 3.4.0)
phing/phing can optionally use package "pecl/Xdebug" (version >= 2.0.5)
phing/phing can optionally use package "pear/Services_Amazon_S3" (version >= 0.3.1)
phing/phing can optionally use package "pear/HTTP_Request2" (version >= 0.5.2)
phing/phing can optionally use package "channel://pear.pdepend.org/PHP_Depend" (version >= 0.10.0)
phing/phing can optionally use package "channel://pear.phpmd.org/PHP_PMD" (version >= 1.1.0)
phing/phing can optionally use package "phpunit/phpcpd" (version >= 1.3.2)
phing/phing can optionally use package "channel://pear.docblox-project.org/DocBlox" (version >= 0.11.0)
phing/phing can optionally use package "pear/PHP_CodeSniffer" (version >= 1.3.0)
No valid packages found
install failed
# ↑では依存性のエラーでインストールできなかったので、--alldepsオプションを付けてやり直す
$ pear install --alldeps phing/phing
Failed to download pear/VersionControl_SVN within preferred state "stable", latest release is version 0.3.4, stability "alpha", use "channel://pear.php.net/VersionControl_SVN-0.3.4" to install
Failed to download pear/VersionControl_Git within preferred state "stable", latest release is version 0.4.4, stability "alpha", use "channel://pear.php.net/VersionControl_Git-0.4.4" to install
WARNING: "pear/PEAR_PackageFileManager" is deprecated in favor of "pear/PEAR_PackageFileManager2"
Failed to download pear/Services_Amazon_S3 within preferred state "stable", latest release is version 0.3.5, stability "alpha", use "channel://pear.php.net/Services_Amazon_S3-0.3.5" to install
Failed to download pear/HTTP_Request2 within preferred state "stable", latest release is version 2.0.0RC2, stability "beta", use "channel://pear.php.net/HTTP_Request2-2.0.0RC2" to install
phing/phing requires PEAR Installer (version >= 1.8.0), installed version is 1.7.2
phing/phing requires package "pear/VersionControl_SVN" (version >= 0.3.4), installed version is 0.3.1
phing/phing can optionally use package "pear/VersionControl_Git" (version >= 0.4.3)
phing/phing can optionally use package "pear/Services_Amazon_S3" (version >= 0.3.1)
phing/phing can optionally use package "pear/HTTP_Request2" (version >= 0.5.2)
phing/phing can optionally use package "channel://pear.pdepend.org/PHP_Depend" (version >= 0.10.0)
phing/phing can optionally use package "channel://pear.phpmd.org/PHP_PMD" (version >= 1.1.0)
phing/phing can optionally use package "channel://pear.docblox-project.org/DocBlox" (version >= 0.11.0)
phing/phingdocs requires PEAR Installer (version >= 1.8.0), installed version is 1.7.2
phpunit/PHPUnit requires PEAR Installer (version >= 1.9.3), installed version is 1.7.2
phpunit/PHPUnit requires package "channel://pear.symfony-project.com/YAML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "curl"
phpunit/PHPUnit can optionally use PHP extension "dbus"
phpunit/phpcpd requires PEAR Installer (version >= 1.9.0), installed version is 1.7.2
phpunit/phpcpd requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/DbUnit requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/DbUnit requires package "channel://pear.symfony-project.com/YAML" (version >= 1.0.2)
phpunit/File_Iterator requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/Text_Template requires PEAR Installer (version >= 1.8.1), installed version is 1.7.2
phpunit/PHP_CodeCoverage requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/PHP_CodeCoverage requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
phpunit/PHP_CodeCoverage requires package "phpunit/File_Iterator" (version >= 1.2.2)
phpunit/PHP_CodeCoverage requires package "phpunit/Text_Template" (version >= 1.0.0)
phpunit/PHP_Timer requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/PHPUnit_MockObject requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/PHPUnit_MockObject requires package "phpunit/Text_Template" (version >= 1.0.0)
phpunit/PHPUnit_Selenium requires PEAR Installer (version >= 1.9.2), installed version is 1.7.2
phpunit/PHP_TokenStream requires PEAR Installer (version >= 1.9.1), installed version is 1.7.2
phpunit/PHP_TokenStream requires package "channel://components.ez.no/ConsoleTools" (version >= 1.6)
downloading xdebug-2.1.2.tgz ...
Starting to download xdebug-2.1.2.tgz (304,229 bytes)
..............................................................done: 304,229 bytes
downloading PHP_CodeSniffer-1.3.0.tgz ...
Starting to download PHP_CodeSniffer-1.3.0.tgz (327,201 bytes)
...done: 327,201 bytes
66 source files, building
ERROR: The DSP xdebug.dsp does not exist.
ERROR: unable to unpack C:\DOCUME~1\SCI01310\LOCALS~1\Temp\pear\download\PHP_CodeSniffer-1.3.0.tgz
# またよくわからないエラーで失敗。
# Googleで検索しても「XAMPPのせい」と一蹴されていたので、依存性を無視してインストールする。
$ pear install -n phing/phing
warning: phing/phing requires package "pear/VersionControl_SVN" (version >= 0.3.4), installed version is 0.3.1
phing/phing can optionally use package "pear/VersionControl_Git" (version >= 0.4.3)
phing/phing can optionally use package "phpunit/PHPUnit" (version >= 3.4.0)
phing/phing can optionally use package "pecl/Xdebug" (version >= 2.0.5)
phing/phing can optionally use package "pear/Services_Amazon_S3" (version >= 0.3.1)
phing/phing can optionally use package "pear/HTTP_Request2" (version >= 0.5.2)
phing/phing can optionally use package "phpunit/phpcpd" (version >= 1.3.2)
phing/phing can optionally use package "docblox/DocBlox" (version >= 0.11.0)
downloading phing-2.4.7.1.tgz ...
Starting to download phing-2.4.7.1.tgz (421,828 bytes)
.....................................................................................done: 421,828 bytes
install ok: channel://pear.phing.info/phing-2.4.7.1
ようやくインストールできました。
動作確認
バージョンが表示できるか確認します。
バージョン表示はOK。
ビルドはどうでしょうか?
$ phing -f C:\temp\build.xml
** ERROR *****************************************************************
* Sorry, can't find the php.exe file.
* You must edit this file (C:\xampp\php\phing.bat) to point to your php.exe (CLI)
* [Currently set to .\php.exe]
**************************************************************************
Phingの再インストールで php.exe が見つけられなくなってしまったようです。
c:\xampp\php\phing.bat を編集し、「SET phpCli」の行を以下のように編集します。
SET phpCli=C:\xampp\php\phing.bat
これでリトライ。
$ phing -f C:\temp\build.xml
Buildfile: C:\temp\build.xml
FooBar > dist:
[echo] uhouho
BUILD FINISHED
Total time: 0.5076 seconds
無事動きました。
参考
最近のコメント