在OSX上通过PEAR安装的PhpDocumentor无法正常工作 - 缺少文件?

时间:2021-01-24 07:14:19

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:

我基本上是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

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 :)

我在网上找不到任何关于错误的内容,所以我再次通过命令行卸载/重新安装,没有错误,但我遇到了同样的问题。我忽略了什么吗?正如我所说,我对PEAR很新:)

Thanks. D

3 个解决方案

#1


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 my php_dir is set to /usr/lib/php. I tried running phpdoc -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 edited include_path to include /usr/lib/php. Mine then looked like:

我运行了梨配置显示为@ashnazg详细,我的php_dir设置为/ usr / lib / php。我试着从那里运行phpdoc -h而且 - 瞧! - 有效。所以对我来说问题是PHP需要知道这条路径。我编辑了php.ini(对我来说是在/private/etc/php.ini中)并编辑了include_path以包含/ usr / lib / php。我看起来像:

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

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.

在那之后,它就像一个魅力!希望这有助于其他人。 FWIW,我在Snow Leopard上,我通过运行sudo pear install phpdocumentor安装了phpdoc。

#2


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 the php_dir setting's value (on my Mac, this is /usr/lib/php/PEAR).

要弄清楚PEAR放置的位置,请运行pear config-show。如果PEAR之前已经说过它已经为你成功安装了PhpDocumentor,那么你要找的文件应该在php_dir设置的值中找到(在我的Mac上,这是/ 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 its php_dir set to some other location.

必须在include_path中设置此php_dir值才能使大多数PEAR包正常运行。由于/ usr / share / pear似乎在您的include_path中,根据您在上面包含的错误,我不得不猜测您的PEAR安装将其php_dir设置为其他位置。

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 use install-time text replacement, which puts YOUR installation's settings into the package's code itself. If you look back at your pear 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.

现在,如果要将PEAR安装更改为指向/ usr / share / pear,则需要了解PEAR如何安装内容。许多软件包使用安装时文本替换,它将您的安装设置放入软件包的代码本身。如果你回顾一下你的pear config-show输出,你会看到其他几个* _dir设置(data_dir,bin_dir,www_dir等)。因此,在安装软件包之前,将它们设置为您想要它们非常重要。不过不用担心,对于已经安装的软件包来说还不算太晚。

To change the PEAR settings, use pear config-set (setting name) (setting value), like pear 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.

要更改PEAR设置,请使用pear config-set(设置名称)(设置值),例如pear config-set php_dir / usr / share / pear。由于只有php_dir绝对必须在您的include_path中,因此您可以保留其他设置。我通常会确保它们都指向同一个根目录,只是为了将所有内容保存在一个整体位置。

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 that install-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 this update for ALL of your installed packages, your PEAR installation will have its files placed where your current include_path is expecting to find them.

更改任何这些设置后,您应该对已安装的每个软件包运行pear更新。这将做的是执行我前面提到的安装时文本替换,但这次将使用当前的设置,即您刚刚完成设置的设置。首先在PEAR主程序包上运行它,梨更新--force pear ...你必须包含--force标志,因为PEAR会意识到你要求我在已经'当前'时更新包并停止本身。一旦为所有已安装的软件包运行此更新,您的PEAR安装将把其文件放在当前include_path期望找到它们的位置。

#3


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.

PhpDocumentor / phpDocumentor / phpdoc.inc是否存在?它存在于/ usr / share / pear中吗?如果答案分别为“是”和“否”,那么您需要在您的包含路径中添加任何目录PhpDocumentor。

Long story short, find phpdoc.inc, and then work from there.

长话短说,找到phpdoc.inc,然后从那里开始工作。

#1


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 my php_dir is set to /usr/lib/php. I tried running phpdoc -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 edited include_path to include /usr/lib/php. Mine then looked like:

我运行了梨配置显示为@ashnazg详细,我的php_dir设置为/ usr / lib / php。我试着从那里运行phpdoc -h而且 - 瞧! - 有效。所以对我来说问题是PHP需要知道这条路径。我编辑了php.ini(对我来说是在/private/etc/php.ini中)并编辑了include_path以包含/ usr / lib / php。我看起来像:

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

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.

在那之后,它就像一个魅力!希望这有助于其他人。 FWIW,我在Snow Leopard上,我通过运行sudo pear install phpdocumentor安装了phpdoc。

#2


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 the php_dir setting's value (on my Mac, this is /usr/lib/php/PEAR).

要弄清楚PEAR放置的位置,请运行pear config-show。如果PEAR之前已经说过它已经为你成功安装了PhpDocumentor,那么你要找的文件应该在php_dir设置的值中找到(在我的Mac上,这是/ 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 its php_dir set to some other location.

必须在include_path中设置此php_dir值才能使大多数PEAR包正常运行。由于/ usr / share / pear似乎在您的include_path中,根据您在上面包含的错误,我不得不猜测您的PEAR安装将其php_dir设置为其他位置。

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 use install-time text replacement, which puts YOUR installation's settings into the package's code itself. If you look back at your pear 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.

现在,如果要将PEAR安装更改为指向/ usr / share / pear,则需要了解PEAR如何安装内容。许多软件包使用安装时文本替换,它将您的安装设置放入软件包的代码本身。如果你回顾一下你的pear config-show输出,你会看到其他几个* _dir设置(data_dir,bin_dir,www_dir等)。因此,在安装软件包之前,将它们设置为您想要它们非常重要。不过不用担心,对于已经安装的软件包来说还不算太晚。

To change the PEAR settings, use pear config-set (setting name) (setting value), like pear 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.

要更改PEAR设置,请使用pear config-set(设置名称)(设置值),例如pear config-set php_dir / usr / share / pear。由于只有php_dir绝对必须在您的include_path中,因此您可以保留其他设置。我通常会确保它们都指向同一个根目录,只是为了将所有内容保存在一个整体位置。

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 that install-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 this update for ALL of your installed packages, your PEAR installation will have its files placed where your current include_path is expecting to find them.

更改任何这些设置后,您应该对已安装的每个软件包运行pear更新。这将做的是执行我前面提到的安装时文本替换,但这次将使用当前的设置,即您刚刚完成设置的设置。首先在PEAR主程序包上运行它,梨更新--force pear ...你必须包含--force标志,因为PEAR会意识到你要求我在已经'当前'时更新包并停止本身。一旦为所有已安装的软件包运行此更新,您的PEAR安装将把其文件放在当前include_path期望找到它们的位置。

#3


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.

PhpDocumentor / phpDocumentor / phpdoc.inc是否存在?它存在于/ usr / share / pear中吗?如果答案分别为“是”和“否”,那么您需要在您的包含路径中添加任何目录PhpDocumentor。

Long story short, find phpdoc.inc, and then work from there.

长话短说,找到phpdoc.inc,然后从那里开始工作。