# How to install php, PEAR, Mail:mimeDecode

## petterg

I have some trouble installing PEAR and Mail_Mime on a new gentoobox:

```

emerge PEAR-PEAR

emerge PEAR-Mail_mime

pear install Mail_Mime

```

In my php script I have

```

require_once 'Mail/mimeDecode.php';

```

The result from running this is

```

Warning: main(PEAR.php): failed to open stream: No such file or directory in /usr/lib/php/Mail/mimeDecode.php on line 35

Fatal error: main(): Failed opening required 'PEAR.php' (include_path='.:/usr/lib/php') in /usr/lib/php/Mail/mimeDecode.php on line 35

```

PEAR.php is located in /usr/share/php/

mimeDecode.php is in /usr/share/php/Mail

Settings in php.ini:

```

include_path = ".:/usr/share/php5:/usr/share/php"

```

phpinfo() confirms that include_path is read from the config file.

Why does it try to open PEAR.php and Mail/mimaDecode from /usr/lib/php/ ? Where is the config for that path?

----------

## DavidJN

Would a symlink perhaps be a nice quick and dirty solution? You might want to feed this back to the devs though.

Sorry I couldn't be more help - I'm not a PHP expert.

----------

## nixnut

Moved from Installing Gentoo to Networking & Security.

Not about installing gentoo, so moved here.

----------

## Kjir

Why did you do 

```
pear install Mail_mime
```

?

Installing with emerge should be enough.

Yet, by the error you showed here I can see that the include_path is wrong. What version of php? Did you modify/use your own php.ini?

Do you have Mail/mimeDecode.php in /usr/lib/php ? What is the output of 

```
pear config-show
```

 ?

----------

## petterg

Symlink works, but I don't like it. Shouldn't there be some setting somewhere that would fix this?

I tried pear install Mail_mime because the php faild to locate mimeDecode.php after emerge. After pear install it managed to locate mimeDecode.php, but failed to locate pear.php.

pear list also did not indicate that Mail_mime was installed before pear install.

----------

## Kjir

Try removing the package with pear and re-emerge them, then post error message and the contents of /usr/share/php  (or php5 if you are using php5). Did you install php from portage or manually? What's your include_path in the relevant php.ini?

----------

## petterg

include_path = ".:/usr/share/php5:/usr/share/php"

I tried pear install Mail_mime because the php faild to locate mimeDecode.php after emerge. After pear install it managed to locate mimeDecode.php, but failed to locate pear.php. 

pear list also did not indicate that Mail_mime was installed before pear install.

uninstalling and reemerging did not change this.

However, unemerging and usint pear install Mail_Mime solved the problem.

----------

## Kjir

 *petterg wrote:*   

> pear list also did not indicate that Mail_mime was installed before pear install.

 

That is normal, it does not mean the package is not installed...

 *petterg wrote:*   

> However, unemerging and usint pear install Mail_Mime solved the problem.

 

Curious. I'll investigate on this, maybe there's a bug in the ebuild

----------

