【问题标题】:Want to know where my PEAR should be installed and where it is located想知道我的 PEAR 应该安装在哪里以及它的位置
【发布时间】:2015-09-20 20:27:38
【问题描述】:

我实际上需要在我的应用程序中实现将整数转换为单词,我遇到了 Pear 的使用,但我似乎不明白他们到底想让我做什么,因为我从哪里得到信息 (http://www.techrepublic.com/article/converting-numbers-to-words-in-php/) 假设它已经在我的电脑中设置了。所以请我需要一个关于如何在我的服务器中设置它的明确指南。我运行 WAMP(Apache 版本 2.4.4/Php 版本 5.4.16)。

【问题讨论】:

标签: php wampserver pear


【解决方案1】:

如何在 WAMPServer PHP 版本上安装 PEAR

在包含要安装 PEAR 扩展的 PHP 版本的文件夹下创建一个名为 PEAR 的新文件夹。例如c:\wamp\bin\php\php.x.y.z\PEAR(我喜欢这里的大写名称,但不一定要这样)

如果go-pear.phar文件在php.x.y.z文件夹中不存在,则从http://pear.php.net/go-pear.phar获取go-pear.phar,并将其保存到php.x.y.z文件夹中,即您正在使用并要下载到的版本.

然后你必须确保你在 windows PATH 上有 php.exe 文件 我们不想永久这样做,因为这会破坏 WAMPServers 通过单击按钮切换 PHP 版本的能力所以忽略您可能看到的任何建议,将其放在您的实际 Windows PATH 环境变量中永久。

所以从命令行要么这样做:

path=%path%;c:\wamp\bin\php\phpx.y.z

( change x and y and z to the version numbers of your PHP )

或者,我使用一个批处理文件,将其保存到我的 Windows 路径中已经存在的文件夹中,我们将其命名为 phppath.bat,然后将其添加到该文件中

path=%path%;c:\wamp\bin\php\phpx.y.z;
php -v

然后您可以随时启动命令窗口,只需键入 >phppath,我就可以访问任何文件夹中的 php.exe,我可能希望编写代码并运行一些 php CLI 源代码。

现在从命令窗口确保您在wamp\bin\php\phpx.y.z,然后键入

CD \wamp\bin\php\php5.4.11
php go-pear.phar

Are you installing a system-wide PEAR or a local copy?
(system|local) [system] : l
Please confirm local copy by typing 'yes' : yes

Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : c:\wamp\bin\php\php5.4.11
 2. Temporary directory for processing            : c:\wamp\bin\php\php5.4.11\tmp
 3. Temporary directory for downloads             : c:\wamp\bin\php\php5.4.11\tmp
 4. Binaries directory                            : c:\wamp\bin\php\php5.4.11
 5. PHP code directory ($php_dir)                 : c:\wamp\bin\php\php5.4.11\pear
 6. Documentation directory                       : c:\wamp\bin\php\php5.4.11\docs
 7. Data directory                                : c:\wamp\bin\php\php5.4.11\data
 8. User-modifiable configuration files directory : c:\wamp\bin\php\php5.4.11\cfg
 9. Public Web Files directory                    : c:\wamp\bin\php\php5.4.11\www
10. Tests directory                               : c:\wamp\bin\php\php5.4.11\tests
11. Name of configuration file                    : c:\wamp\bin\php\php5.4.11\pear.ini
12. Path to CLI php.exe                           : c:\wamp\bin\php\php5.4.11

1-12, 'all' or Enter to continue:
Beginning install...
Configuration written to D:\wamp\bin\php\php5.4.11\pear.ini...
Initialized registry...
Preparing to install...
installing phar://c:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar...
installing phar://c:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar...
installing phar://c:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar...
installing phar://c:/wamp/bin/php/php5.4.11/PEAR/go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar...
installing phar://c:/wamp/bin/php/php5.4.11/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.4
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!  The include_path defined in the currently used php.ini does not
contain the PEAR PHP directory you just specified:
<c:\wamp\bin\php\php5.4.11\pear>
If the specified directory is also not in the include_path used by
your scripts, you will have problems getting any PEAR packages working.


Would you like to alter php.ini <c:\wamp\bin\php\php5.4.11\php.ini>? [Y/n] : n

Please look over your php.ini file to make sure
c:\wamp\bin\php\php5.4.11\pear is in your include_path.
Current include path           : .;c:\wamp\bin\php\php5.4.11\PEAR
Configured directory           : c:\wamp\bin\php\php5.4.11\pear
Currently used php.ini (guess) : c:\wamp\bin\php\php5.4.11\php.ini
Press Enter to continue:

** WARNING! Old version found at c:\wamp\bin\php\php5.4.11, please remove it or be sure to use the new c:\wamp\bin\php\php5.4.11\pear.bat command

'pear' 命令现在在 c:\wamp\bin\php\php5.4.11\pear.bat 为您服务

测试有效

>pear

应该给你看这样的东西

C:\wamp\bin\php\php5.4.11>pear
Commands:
build                  Build an Extension From C Source
bundle                 Unpacks a Pecl Package
channel-add            Add a Channel
channel-alias          Specify an alias to a channel name
channel-delete         Remove a Channel From the List
channel-discover       Initialize a Channel from its server
channel-info           Retrieve Information on a Channel
channel-login          Connects and authenticates to remote channel server
channel-logout         Logs out from the remote channel server
channel-update         Update an Existing Channel
clear-cache            Clear Web Services Cache
config-create          Create a Default configuration file
config-get             Show One Setting
config-help            Show Information About Setting
config-set             Change Setting
config-show            Show All Settings
convert                Convert a package.xml 1.0 to package.xml 2.0 format
cvsdiff                Run a "cvs diff" for all files in a package
cvstag                 Set CVS Release Tag
download               Download Package
download-all           Downloads each available package from the default channel
info                   Display information about a package
install                Install Package
list                   List Installed Packages In The Default Channel
list-all               List All Packages
list-channels          List Available Channels
list-files             List Files In Installed Package
list-upgrades          List Available Upgrades
login                  Connects and authenticates to remote server [Deprecated in favor of channel-login]
logout                 Logs out from the remote server [Deprecated in favor of channel-logout]
makerpm                Builds an RPM spec file from a PEAR package
package                Build Package
package-dependencies   Show package dependencies
package-validate       Validate Package Consistency
pickle                 Build PECL Package
remote-info            Information About Remote Packages
remote-list            List Remote Packages
run-scripts            Run Post-Install Scripts bundled with a package
run-tests              Run Regression Tests
search                 Search remote package database
shell-test             Shell Script Test
sign                   Sign a package distribution file
svntag                 Set SVN Release Tag
uninstall              Un-install Package
update-channels        Update the Channel List
upgrade                Upgrade Package
upgrade-all            Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]
Usage: pear [options] command [command-options] <parameters>
Type "pear help options" to list all options.
Type "pear help shortcuts" to list all command shortcuts.
Type "pear help <command>" to get the help for the specified command.


C:\wamp\bin\php\php5.4.11>pear list-channels
REGISTERED CHANNELS:
====================
CHANNEL      ALIAS   SUMMARY
doc.php.net  phpdocs PHP Documentation Team
pear.php.net pear    PHP Extension and Application
                     Repository
pecl.php.net pecl    PHP Extension Community Library
__uri        __uri   Pseudo-channel for static packages

【讨论】:

  • 请查看我的 php.ini 包含并告诉我是否正确
  • include_path = "c:\php\includes;c:\wamp\bin\php\php5.5.12\pear\PEAR"
  • 通常如果您使用 WAMPServer,所有内容都应该在某处 \wamp\..... 下不知道为什么您有 C:\php\include 在那里
  • 目前,在我删除了之前的梨之后,我再次重新安装了梨,现在我必须按照您的程序进行操作,正如我们所说,它按照指示工作,这就是我在我的 php 中所拥有的.ini 包含路径; include_path = ".;c:\wamp\bin\php\php5.5.12\pear" 仅此而已。我将 Numbers 下载到 pear\PEAR 目录中的类模块中,但它却找不到 words.php 文件....错误!
猜你喜欢
  • 2014-06-27
  • 1970-01-01
  • 2022-06-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多