在 OSX 上通过 PEAR 安装的 PhpDocumentor 无法工作 - 缺少文件?
我基本上是 PEAR(和 PhpDocumentor)的新手; 我使用 PEAR CLI 安装了 PhpDocumentor,一切似乎都很顺利...直到我去使用它,此时我收到以下错误:
Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc):
failed to open stream: No such file or directory in
/usr/local/bin/phpdoc on line 40
Fatal error: require(): Failed opening required
'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/usr/share/pear')
in /usr/local/bin/phpdoc on line 40
我无法在网上找到有关该错误的任何内容,因此我通过卸载/重新安装再次输入命令行,没有错误,但我遇到了同样的问题。 我是不是忽略了什么? 正如我所说,我对 PEAR 还很陌生:)
谢谢。 D
I'm basically new to PEAR (and PhpDocumentor); I installed PhpDocumentor using the PEAR CLI, and everything seemed to go fine... until I went to use it, at which point I got the following error:
Warning: require(PhpDocumentor/phpDocumentor/phpdoc.inc):
failed to open stream: No such file or directory in
/usr/local/bin/phpdoc on line 40
Fatal error: require(): Failed opening required
'PhpDocumentor/phpDocumentor/phpdoc.inc' (include_path='.:/usr/share/pear')
in /usr/local/bin/phpdoc on line 40
I couldn't find anything online about the error, so I uninstalled/reinstalled via the command line again without error, but I'm getting the same problem. Have I overlooked something? As I said I'm quite new to PEAR :)
Thanks. D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好吧,这个问题很老了,但我也遇到了同样的问题,并在费尽心思后解决了它,所以我想我会分享。
我按照@ashnazg 详细运行了
pear config-show
,并且我的php_dir
设置为/usr/lib/php
。 我尝试从那里运行 phpdoc -h ,然后——瞧! - 有效。 所以对我来说问题是 PHP 需要知道这条路径。 我编辑了 php.ini(对我来说位于 /private/etc/php.ini 中)并编辑了include_path
以包含/usr/lib/php
。 我的看起来像:在那之后,它就像一个魅力! 希望这对其他人有帮助。 FWIW,我在 Snow Leopard 上,通过运行 sudo pear install phpdocumentor 安装了 phpdoc。
Well, this question is comically old, but I just had this same issue and solved it after much head-scratching so I thought I'd share.
I ran
pear config-show
as @ashnazg detailed and myphp_dir
is set to/usr/lib/php
. I tried runningphpdoc -h
from there and -- voila! -- it worked. So the issue for me was that PHP needed to know about this path. I edited php.ini (which for me is in /private/etc/php.ini) and editedinclude_path
to include/usr/lib/php
. Mine then looked like:After that, it works like a charm! Hope this helps someone else out there. FWIW, I'm on Snow Leopard and I installed phpdoc by running
sudo pear install phpdocumentor
.要弄清楚 PEAR 将东西放在哪里,请运行
pear config-show
。 如果 PEAR 之前说过它已经为您成功安装了 PhpDocumentor,那么您要查找的文件应该可以在php_dir
设置的值中找到(在我的 Mac 上,这是/usr/ lib/php/PEAR
)。为了使大多数 PEAR 包正常运行,必须在 include_path 中设置此
php_dir
值。 由于/usr/share/pear
确实出现在您的 include_path 中,根据您上面包含的错误,我不得不猜测您的 PEAR 安装有其php_dir
设置到其他位置。现在,如果您想将 PEAR 安装更改为指向
/usr/share/pear
,您需要了解 PEAR 如何安装。 许多软件包使用安装时文本替换
,它将您的安装设置放入软件包本身的代码中。 如果您回顾一下pear config-show
输出,您会看到其他几个 *_dir 设置(data_dir、bin_dir、www_dir 等)。 因此,在安装软件包之前按照您的需要进行设置非常重要。 不过不用担心,对于您已经安装的软件包来说还不算太晚。要更改 PEAR 设置,请使用
pear config-set(设置名称)(设置值)
,例如pear config-set php_dir /usr/share/pear
。 由于只有 php_dir 绝对需要位于您的 include_path 中,因此您可以保留其他设置不变。 我通常确保它们都指向同一个根目录,只是为了将所有内容都放在一个整体位置。一旦更改任何这些设置,您应该对已安装的每个软件包运行
pear update
。 这将执行我之前提到的安装时文本替换
,但这次将使用当前的设置,即您刚刚完成设置的设置。 首先在 PEAR 主包上运行此命令,pear update --force pear
...您必须包含--force
标志,因为 PEAR 会实现你要求我在包已经是“当前”时更新包并自行停止。 对所有已安装的软件包运行此更新
后,您的 PEAR 安装会将其文件放置在当前include_path
期望找到的位置。To figure out where PEAR is putting things, run
pear config-show
. If PEAR had said earlier that it had successfully installed PhpDocumentor for you, then the file you're looking for should be found in thephp_dir
setting's value (on my Mac, this is/usr/lib/php/PEAR
).It is necessary for this
php_dir
value to be set in your include_path for most PEAR packages to function properly. Since/usr/share/pear
DOES appear to be in your include_path, as per the error you included above, I'd have to guess that your PEAR installation has itsphp_dir
set to some other location.Now, if you want to change your PEAR installation to point to
/usr/share/pear
, you need to understand something about how PEAR installs things. Many packages useinstall-time text replacement
, which puts YOUR installation's settings into the package's code itself. If you look back at yourpear config-show
output, you'll see several other *_dir settings (data_dir, bin_dir, www_dir, etc.). So, it's important that these be set like you want them BEFORE you install your packages. Don't worry though, it's not too late for the packages you have installed already.To change the PEAR settings, use
pear config-set (setting name) (setting value)
, likepear config-set php_dir /usr/share/pear
. Since only php_dir is absolutely necessary to be in your include_path, you can probably leave the other settings as they are. I usually make sure they all point into the same root directory, just to keep everything in one overall place.Once you change ANY of these settings, you should run a
pear update
of each and every package you already have installed. What this will do is perform thatinstall-time text replacement
I mentioned earlier, but this time will use the settings that are current, i.e. the ones you've just finished setting. Run this on the PEAR main package first,pear update --force pear
... you'll have to include the--force
flag because PEAR will realize you're asking me to update the package when it's already 'current' and stop itself. Once you've run thisupdate
for ALL of your installed packages, your PEAR installation will have its files placed where your currentinclude_path
is expecting to find them.PhpDocumentor/phpDocumentor/phpdoc.inc 是否存在? 它存在于 /usr/share/pear 中吗? 如果答案分别为“是”和“否”,那么您需要将 PhpDocumentor 所在的任何目录添加到包含路径中。
长话短说,找到 phpdoc.inc,然后从那里开始工作。
Does PhpDocumentor/phpDocumentor/phpdoc.inc exist? Does it exist in /usr/share/pear ? If the answers are "yes" and "no" respectively, then you need to add whatever dir PhpDocumentor is in to your include path.
Long story short, find phpdoc.inc, and then work from there.