PHP + Pear | Pyrus + Mail;邮件无法找到Pear.php

时间:2015-11-04 16:17:53

标签: php email pear pyrus

我已经好好打了几个星期了。我找到了很多有类似问题的人,并且在解决我的问题方面有所进展,但并非一直如此。

WAMPserver 2.5(PHP 5.5.12)

我最初安装了Pear,但有些东西搞砸了(配置中的路径很疯狂?),所以我再次尝试安装,然后事情变得非常混乱,所以我删除了与Pear相关的所有内容(除了pear子目录因为Windows抱怨说其中的文件正在使用中,即使它是空的),并给了Pyrus一个机会。现在看起来事情似乎更好,至少作为包管理。

我相信我已正确设置了include_path,因为现在我的脚本至少可以找到Mail.php脚本。

include_path = ".;C:\wamp\bin\php\php5.5.12\pear\php"

我的电话,工作:

include_once("Mail.php");

然而,Mail.php现在抱怨它无法找到Pear.php:

无法打开所需的' PEAR.php' (include_path ='。; C:\ wamp \ bin \ php \ php5.5.12 \ pear \ php')在C:\ wamp \ bin \ php \ php5.5.12 \ pear \ php \ Mail.php中第46行

\ php5.5.12下没有任何Pear.php文件。

这是因为我使用了Pyrus,并且Mail设置为在Pear环境中工作吗? (尽管Pyrus声称是"使用PEAR安装在C:\ wamp \ bin \ php \ php5.5.12 \ 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等。

GACK。我是否必须为每个扩展名指定一个单独的include_path条目?或者,我应该摆脱\ php并将其内容移动到\ pear,并使用相关的代码和配置更改?或者只是将所有扩展文件(没有目录树)转储到与我的脚本相同的www目录中?

1 个答案:

答案 0 :(得分:0)

最容易做到的,没有移动文件,就是这样:

include_path = ".;C:\wamp\bin\php\php5.5.12\pear;C:\wamp\bin\php\php5.5.12\pear\php"

但真的不应该是一个子目录。 Mail.php应与Pear.php位于同一目录。

(我在Linux上使用这些东西,所以我不知道这个特定的发行版通常如何设置。)