簡體   English   中英

PHP +梨| Pyrus +郵件; 郵件找不到Pear.php

[英]PHP + Pear|Pyrus + Mail; Mail can't find Pear.php

我已經為此努力了好幾個星期。 我發現有很多人遇到類似的問題,並且在解決我的問題上走得更遠,但並非一路走來。

WAMPserver 2.5(PHP 5.5.12)

我最初安裝了Pear,但是有些東西搞砸了(配置中的路徑太瘋狂了?),所以我再次嘗試安裝,然后事情真的搞砸了,所以我刪除了所有與Pear有關的東西(除了pear subdir,因為Windows抱怨說a文件(即使它是空的)都在使用中),並給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 \\ php \\ php5.5.12 \\ pear \\ php \\中打開所需的'PEAR.php'(include_path ='.; C:\\ wamp \\ bin \\ php \\ php5.5.12 \\ pear \\ php')第46行的Mail.php

\\ 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錯誤。 但是現在,郵件找不到Net_SMTP等。

GACK。 我必須為每個擴展名指定一個單獨的include_path條目嗎? 或者,我應該擺脫\\ php並將其內容移到\\ pear中,並進行相關的代碼和配置更改嗎? 或者只是將所有擴展文件(沒有目錄樹)轉儲到與我的腳本相同的www目錄中?

在不移動文件的情況下,最容易做到的是:

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

但實際上不應該有一個子目錄。 Mail.php應與Pear.php位於同一目錄中。

(盡管我在Linux上使用了這些東西,所以我不知道該特定發行版通常如何設置。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM