Cannot include a pear pack that definitely exists (and is installed)

I installed the Mail_Mime package.

include('Mail.php'); include('Mail/mime.php'); 

I get the following errors:

 Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.php on line 2 Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.:/usr/lib/php/PEAR:/usr/lib/php/modules') in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.php on line 2 Warning: include(Mail/mime.php) [function.include]: failed to open stream: No such file or directory in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.php on line 3 Warning: include() [function.include]: Failed opening 'Mail/mime.php' for inclusion (include_path='.:/usr/lib/php/PEAR:/usr/lib/php/modules') in /var/www/vhosts/domain.co.uk/httpdocs/mail_mime/index.php on line 3 

2 files are located in folders:

 /usr/lib/php/PEAR/Mail.php /usr/lib/php/PEAR/Mail/mime.php 

pear list tells me that the required packages are installed and there are no missing dependencies

+6
php pear
source share
2 answers

Does it enter your inclusion path?

 var_dump(get_include_path()); 

If this is not the case, try adding this before hand to add it to the include path:

at runtime:

 $path = get_include_path() . PATH_SEPARATOR . '/usr/lib/php/PEAR'; set_include_path($path); 

Or in php.ini

 include_path=".:--Whatever here already--:/usr/lib/php/PEAR" 

On the side of the note, if you care about inclusion, why not use require_once? This will prevent it from being turned on several times (part of _once) and lead to a fatal error. It will also prevent the rest of the code from executing if it cannot be found ...

+7
source share

For Plesk users using virtual hosts: remember to include the Directory directive in vhost.conf in /var/www/vhosts/yourdomain/subdomains/yoursubdomain/conf/vhost.conf when you install open_basedir to include the PEAR libraries

 <Directory /var/www/vhosts/yourdomain/subdomains/yoursubdomain/httpdocs> <IfModule mod_php4.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir "/var/www/vhosts/yourdomain/subdomains/yoursubdomain/httpdocs:/tmp:/usr/share/php" </IfModule> <IfModule mod_php5.c> php_admin_flag engine on php_admin_flag safe_mode off php_admin_value open_basedir "var/www/vhosts/yourdomain/subdomains/yoursubdomain/httpdocs:/tmp:/usr/share/php" </IfModule> Options -Includes -ExecCGI </Directory> 
+1
source share

All Articles