Pete
Pete

Reputation: 61

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

I've been banging my head on this for weeks now. I've found many people with similar issues, and have gotten a little farther towards solving my issue, but not all the way.

WAMPserver 2.5 (PHP 5.5.12)

I originally installed Pear, but something was messed up (paths in config were crazy?), so I tried installing again, and then things got really messed up, so I removed everything Pear-related (except the pear subdir because Windows complained that a file in it was in use, even though it was empty), and gave Pyrus a shot. Now things seem to be working better at least as package management.

I believe I have my include_path(s) set correctly because now my script can at least find the Mail.php script.

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

my call, working:

include_once("Mail.php");

However, Mail.php is now complaining that it can't find Pear.php:

Failed opening required 'PEAR.php' (include_path='.;C:\wamp\bin\php\php5.5.12\pear\php') in C:\wamp\bin\php\php5.5.12\pear\php\Mail.php on line 46

There is no Pear.php file anywhere under \php5.5.12.

Is this happening because I'm using Pyrus, and Mail is set up to work in a Pear environment? (Even though Pyrus claims to be "Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear", see below.) Do I have to install both Pear and Pyrus? Should I use pyrus.phar to install Pear? As noted above, previous attempts to install Pear were less than successful. The documentation for both Pear and Pyrus could be improved by having a graphic depicting how a standard install ought to look like in terms of subdirs, etc. This is how my include_path branch looks like now:

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

Here's my Pyrus config:

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

Any help will be greatly appreciated.

Update: I tried

php pyrus.phar install pear/PEAR

as shown on https://pear.php.net/package/PEAR/.

I get:

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

Why is it trying to rename my entire php5.5.12 directory? Or is it? FTW?

Update: OK, I manually installed Pear. Changed include_path to

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

and my call to

include_once("php\Mail.php");

And I've gotten past the "missing" Pear.php error. But now, Mail can't find Net_SMTP, etc.

Gack. Do I have to specify a separate include_path entry for each extension? Or, should I get rid of \php and move its contents into \pear, with associated code and config changes? Or just dump all the extension files (without dir tree) into the same www dir as my script?

Upvotes: 2

Views: 545

Answers (1)

miken32
miken32

Reputation: 42716

Easiest to do, without moving files, would be this:

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

But there really shouldn't be a subdirectory. Mail.php should be in the same directory as Pear.php.

(I use this stuff on Linux though, so I don't know how this particular distribution normally sets things up.)

Upvotes: 0

Related Questions