几个星期以来,我一直在努力解决这个问题。我发现很多人都有类似的问题,并且在解决我的问题方面取得了一些进展,但并非一直如此。
WAMPserver 2.5 (PHP 5.5.12)
我最初安装了 Pear,但是有些东西搞砸了(配置中的路径很疯狂?),所以我尝试再次安装,然后事情变得非常混乱,所以我删除了所有与 Pear 相关的内容(除了 pear 子目录,因为 Windows 抱怨说文件中的文件正在使用中,即使它是空的),并给了 Pyrus 一个机会。现在,至少在包管理方面,事情似乎变得更好了。
我相信我的 include_path(s) 设置正确,因为现在我的脚本至少可以找到 Mail.php 脚本。
include_path = ".;C:\wamp\bin\php\php5.5.12\pear\php"
我的电话,工作:
include_once("Mail.php");
但是,Mail.php 现在抱怨找不到 Pear.php:
在 C:\wamp\bin\php\php5.5.12\pear\php\ 中打开所需的 'PEAR.php' (include_path='.;C:\wamp\bin\php\php5.5.12\pear\php') 失败Mail.php 在第 46 行
\php5.5.12 下的任何地方都没有 Pear.php 文件。
发生这种情况是因为我使用的是 Pyrus,并且 Mail 设置为在 Pear 环境中工作吗?(尽管 Pyrus 声称“使用位于 C:\wamp\bin\php\php5.5.12\pear 的 PEAR 安装”,见下文。)我是否必须同时安装 Pear 和 Pyrus?我应该使用 pyrus.phar 来安装 Pear 吗?如上所述,以前安装 Pear 的尝试不太成功。Pear 和 Pyrus 的文档可以通过使用图形描述标准安装在子目录等方面的外观来改进。这就是我的 include_path 分支现在的样子:
c:\wamp\bin\php\php5.5.12\pear\php>tree /f
Folder PATH listing for volume OS
Volume serial number is A4D7-1271
C:.
│ Mail.php
│
├───Auth
│ │ SASL.php
│ │
│ └───SASL
│ Anonymous.php
│ Common.php
│ CramMD5.php
│ DigestMD5.php
│ External.php
│ Login.php
│ Plain.php
│ SCRAM.php
│
├───Mail
│ mail.php
│ mock.php
│ null.php
│ RFC822.php
│ sendmail.php
│ smtp.php
│ smtpmx.php
│
└───Net
SMTP.php
Socket.php
这是我的 Pyrus 配置:
c:\wamp\bin\php\php5.5.12>php pyrus.phar get
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear
System paths:
php_dir => C:\wamp\bin\php\php5.5.12\pear\php
ext_dir => c:\wamp\bin\php\php5.5.12\ext\
cfg_dir => C:\wamp\bin\php\php5.5.12\pear\cfg
doc_dir => C:\wamp\bin\php\php5.5.12\pear\docs
bin_dir => C:\wamp\bin\php\php5.5.12
data_dir => C:\wamp\bin\php\php5.5.12\pear\data
www_dir => C:\wamp\bin\php\php5.5.12\pear\www
test_dir => C:\wamp\bin\php\php5.5.12\pear\tests
src_dir => C:\wamp\bin\php\php5.5.12\pear\src
php_bin => C:\wamp\bin\php\php5.5.12\php.exe
php_ini => C:\wamp\bin\php\php5.5.12\php.ini
php_prefix =>
php_suffix =>
Custom System paths:
User config (from C:\Users\mrz\pear\pearconfig.xml):
default_channel => pear2.php.net
auto_discover => 0
http_proxy =>
cache_dir => C:\wamp\bin\php\php5.5.12\pear\cache
temp_dir => C:\wamp\bin\php\php5.5.12\pear\temp
verbose => 1
preferred_state => stable
umask => 0022
cache_ttl => 3600
my_pear_path => C:\wamp\bin\php\php5.5.12\pear
plugins_dir => C:\Users\mrz\pear
(variables specific to pear2.php.net):
username =>
password =>
preferred_mirror => pear2.php.net
download_dir => C:\wamp\bin\php\php5.5.12\pear\downloads
openssl_cert =>
handle =>
paranoia => 2
Custom User config (from C:\Users\mrz\pear\pearconfig.xml):
(variables specific to pear2.php.net):
任何帮助将不胜感激。
更新:我试过了
php pyrus.phar install pear/PEAR
如https://pear.php.net/package/PEAR/所示。
我得到:
c:\wamp\bin\php\php5.5.12>php pyrus.phar install pear/PEAR
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear
Downloading pear.php.net/PEAR
Mime-type: application/octet-stream
Downloading pear.php.net/Archive_Tar=================================================================>] 100% (284/284 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/Structures_Graph============================================================>] 100% (19/19 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/Console_Getopt==============================================================>] 100% (12/12 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/XML_Util====================================================================>] 100% ( 5/ 5 kb)
Mime-type: application/octet-stream
[====================================================================================================>] 100% (16/16 kb)
Warning: rename(C:\wamp\bin\php\php5.5.12,C:\wamp\bin\php\.old-php5.5.12): The process cannot access the file because it is bein
g used by another process. (code: 32) in phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransacti
on/Transaction/TwoStage.php on line 82
Call Stack:
0.0350 1218224 1. {main}() C:\wamp\bin\php\php5.5.12\pyrus.phar:0
0.0580 2198784 2. Pyrus\ScriptFrontend\Commands->run() C:\wamp\bin\php\php5.5.12\pyrus.phar:69
0.0970 3600832 3. Pyrus\ScriptFrontend\Commands->install() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/ph
p/Pyrus/ScriptFrontend/Commands.php:309
0.1110 4364600 4. Pyrus\Installer::commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/ScriptF
rontend/Commands.php:559
8.9739 11845424 5. Pyrus\AtomicFileTransaction::commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/P
yrus/Installer.php:344
8.9739 11845496 6. Pyrus\AtomicFileTransaction\Manager->commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0
a4/php/Pyrus/AtomicFileTransaction.php:90
8.9919 11845456 7. Pyrus\AtomicFileTransaction\Transaction\TwoStage->commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.pha
r/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransaction/Manager.php:165
8.9919 11845488 8. rename() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransaction/Tr
ansaction/TwoStage.php:82
Pyrus\Installer\Exception: Installation failed
Pyrus\AtomicFileTransaction\MultiException: ERROR: commit failed
Pyrus\IOException: CRITICAL - unable to complete transaction, rename of actual to backup path failed
Pyrus\AtomicFileTransaction\RuntimeException: Cannot rollback - not in a transaction
为什么它试图重命名我的整个 php5.5.12 目录?或者是吗?FTW?
更新:好的,我手动安装了 Pear。将 include_path 更改为
include_path = ".;C:\wamp\bin\php\php5.5.12\pear"
和我的电话
include_once("php\Mail.php");
而且我已经克服了“缺失”的 Pear.php 错误。但是现在,Mail 找不到 Net_SMTP 等。
盖克。我是否必须为每个扩展指定单独的 include_path 条目?或者,我是否应该摆脱 \php 并将其内容移动到 \pear 中,以及相关的代码和配置更改?或者只是将所有扩展文件(没有目录树)转储到与我的脚本相同的 www 目录中?