10

Max OS X 10.7.. を実行するphing -vと、次のエラーが表示されます。

Warning: require_once(phing/Project.php): failed to open stream: No such file or directory in /usr/lib/php/pear/phing/Phing.php on line 22

Fatal error: require_once(): Failed opening required 'phing/Project.php' (include_path='.:') in /usr/lib/php/pear/phing/Phing.php on line 22

私が使用したコマンドは次のとおりです。

pear config-set auto_discover 1
pear install phing/phing

ここに私のphp.iniがあります:

include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php"

php、pear、および phing に対して whereis を実行すると、以下が返されます。

bash-3.2$ whereis php
/usr/bin/php

bash-3.2$ whereis pear
/usr/bin/pear

bash-3.2$ whereis phing
/usr/bin/phing

pear に対して config-get を実行すると、以下が返されます。

→ pear config-get php_dir
/usr/lib/php/pear

このフォルダーをチェックしてsystem.phpおり、phing.php両方がこのパスに存在します。

4

4 に答える 4

25

Seems like include_path is somehow broken.

Check PEAR's directory:

pear config-get php_dir
/usr/lib/php

Whatever directory is returned, it should contain PEAR files (System.php and phing files in particular)

Check that correct php.ini is used:

Run php --ini and see what INI file is being loaded. Then make sure this INI files contains PEAR directory in it's include_path

Check include_path:

Run php -c /path/to/php.ini -r 'echo get_include_path() . "\n";'.


Update

The problem is indeed with include_path since the error message reports (include_path='.:') which clearly shows that PEAR is NOT in your include path. This means that wrong php.ini is being loaded for CLI PHP. To fix it, find correct php.ini file (step 2) and add

include_path = ".:/usr/lib/php/pear" 

to it.

于 2012-04-20T21:40:46.650 に答える
0

Mac LION ユーザー ( macport 経由でインストールするユーザー) 向けに、もう 1 つ簡単なソリューションを追加したいだけですが、ヒョウでも機能する可能性があります。

  1. このスクリプトをどこにでもダウンロードできます。場所は関係ありません

    curl http://pear.php.net/go-pear.phar > go-pear.phar
    
  2. このコマンドを実行します

    sudo php -q go-pear.phar
    
  3. パスを尋ねられますが、変更する必要はありませんが、これらのパスにナシ関連のファイルが含まれていることを確認してください。

  4. これらのインクルード パスを使用して php.ini を更新するかどうかを尋ねられます [Y]

あなたは終わった!phing と入力すると、build.xml を要求する必要があります。

于 2012-05-01T00:26:14.380 に答える
-2

または、サーバーにアクセスできない場合は、次のようにすることができます。

$root = $SERVER['DOCUMENT_ROOT'];

常にプロジェクトのルートを参照し、そこからフォルダー/ファイルを参照できます。
そのようにすれば、サーバーに触れる必要はありません。

于 2012-04-20T21:14:56.640 に答える