Failed opening required MDB2.php

4.2k views Asked by At

When trying to run Pear Mailqueue on a new server, I get this error message:

PHP Warning:  require_once(MDB2.php): failed to open stream: No such file or directory in /usr/share/php5/PEAR/Mail/Queue/Container/mdb2.php on line 57
PHP Fatal error:  require_once(): Failed opening required 'MDB2.php' (include_path='.:/usr/share/php5:/usr/share/php5/PEAR') in /usr/share/php5/PEAR/Mail/Queue/Container/mdb2.php on line 57

What I find weird is that the code seems to be missing a file called 'MDB2.php' (upper-case), but the file causing the error is called 'mdb2.php' (lower-case). Not sure if this means something or not.

As far as I can tell, all the paths are correct and set correctly in PHP. Here's the diagnostic steps I have researched and tried so far:

# pear config-get php_dir
/usr/share/php5/PEAR

# pear version
PEAR Version: 1.9.4
PHP Version: 5.4.20
Zend Engine Version: 2.4.0
Running on: Linux myserver 3.11.10-7-default #1 SMP Mon Feb 3 09:41:24 UTC 2014 (750023e) x86_64

# php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/conf.d
Additional .ini files parsed:      /etc/php5/conf.d/ctype.ini,
/etc/php5/conf.d/curl.ini,
/etc/php5/conf.d/dom.ini,
/etc/php5/conf.d/gd.ini,
/etc/php5/conf.d/iconv.ini,
/etc/php5/conf.d/json.ini,
/etc/php5/conf.d/mbstring.ini,
/etc/php5/conf.d/mysql.ini,
/etc/php5/conf.d/mysqli.ini,
/etc/php5/conf.d/openssl.ini,
/etc/php5/conf.d/pdo.ini,
/etc/php5/conf.d/pdo_mysql.ini,
/etc/php5/conf.d/pdo_sqlite.ini,
/etc/php5/conf.d/soap.ini,
/etc/php5/conf.d/sqlite3.ini,
/etc/php5/conf.d/tokenizer.ini,
/etc/php5/conf.d/xmlreader.ini,
/etc/php5/conf.d/xmlwriter.ini,
/etc/php5/conf.d/zip.ini,
/etc/php5/conf.d/zlib.ini

# php -c /etc/php5/cli/php.ini -r 'echo get_include_path()."\n";'
.:/usr/share/php5:/usr/share/php5/PEAR

# ls /usr/share/php5/PEAR/Mail/Queue/Container -lsah
total 100K
 20K -rw-r--r-- 1 root root  18K Dec 10 15:30 --MDB2.php
4.0K drwxr-xr-x 2 root root 4.0K Dec 10 15:48 .
4.0K drwxr-xr-x 3 root root 4.0K May  3  2014 ..
 16K -rw-r--r-- 1 root root  15K May  3  2014 creole.php
 16K -rw-r--r-- 1 root root  16K May  3  2014 db.php
 20K -rw-r--r-- 1 root root  20K May  3  2014 mdb.php
 20K -rw-r--r-- 1 root root  18K Dec 10 15:48 mdb2.php

So the file is there, but if I can trust the error message, it expects the file to be named with upper case letters. I also don't know what the --MDB2.php file is.

I tried renaming the --MDB2.php file to MDB2.php, but then I get this error:

PHP Fatal error:  Cannot redeclare class Mail_Queue_Container_mdb2 in /usr/share/php5/PEAR/Mail/Queue/Container/mdb2.php on line 71

Otherwise, Pear appears to be installed correctly and reacts to terminal pear commands...

Is this a buggy version of Pear or Mail Queue or something?

-- edit --

The file mdb2.php contains this line early on:

require_once 'MDB2.php';

So maybe there is another file of that name that is supposed to exist somewhere else ... ?

-- edit 2 --

Since I saw another post reference this information, maybe this will help:

# pear list
Installed packages, channel pear.php.net:
=========================================
Package            Version State
Archive_Tar        1.3.11  stable
Console_Getopt     1.3.1   stable
DB                 1.8.2   stable
HTTP_Request       1.4.4   stable
MDB2               2.5.0b5 beta
MDB2_Driver_mysql  1.4.1   stable
MDB2_Driver_mysqli 1.5.0b4 beta
Mail               1.2.0   stable
Mail_Mime          1.8.8   stable
Mail_Queue         1.2.7   stable
Net_SMTP           1.6.2   stable
Net_Socket         1.0.10  stable
Net_URL            1.0.15  stable
PEAR               1.9.4   stable
SOAP               0.12.0  beta
Structures_Graph   1.0.4   stable
XML_Util           1.2.1   stable
1

There are 1 answers

1
cweiske On

There should be a file MDB2.php in /usr/share/php5/PEAR.

Do you have the error in your browser? Then PHP on apache has a different php.ini than your CLI.

Use set_include_path('.:/usr/share/php5/PEAR'); in your code to try if it works. If it does, find the apache php.ini file (via phpinfo();) and modify it there.