How to Install PHP Mailparse in Fedora

Posted on Aug 5 2012 - 7:59pm by maddyacca

Installing the the mailparse extension under PHP is explained in this article. This extension is installed under Fedora. This file on its own is not workable like all other extensions; instead it needs mbstring extension for proper operation. In addition, the order of installation is of primary importance otherwise it won’t function properly. This process can be used as a stencil for many such extensions as well.

Note: The procedure needs to be done under command line root (su -).

 Steps To Install PHP Mailparse in Fedora

Step 1: Access a temporary directory or make one if there isn’t one already. You will have the extension.

wget http://pecl.php.net/get/mailparse

In the end you will have a file “mailparse-X.Y.Z.tgz”. Note that X.Y.Z refers to file version and will be replaced by it in the original name it gets.

Step 2: Take the code out of the extension:

tar zxf mailparse-X.Y.Z.tgz

Replace “X-Y-Z” with the actual version name first.

Step 3: Access package directory as follows:

cd mailparse-X.Y.Z

Step 4: At this stage, you need the package ready for your PHP:

phpize

Step 5: Next is to configure it for the same compilation:

./configure

Step 6: All things ready, initiate Compilation:

make

Step 7: Next follows command for Installation:

make install

[adsense]

Step 8: Locate mbstring’s ini file:

rpm -q -l php-mbstring

Step 9: When the earlier step gives output, then search for an ini file. Once found, edit it and type out:

“extension=mbstring.so” (Prefix a semicolon)

Step 10: Next is to instruct PHP to use both the extensions mbstring and mailparse in the series they are:  First edit file /etc/php.ini. At the very last of Dynamic Extensions part, add these:

extension=mbstring.so

extension=mailparse.so

Step 11: This is practically the last compulsory step of the entire process and it is to restart Apache:

service httpd restart

Step 12: You might or might not want to but you can clear or remove the temporary directory you made at the start of the process.

 

Tips

  • Statement says it is enough to add “extension=mailparse.so” in /etc/php.ini after installation of   mbstring and compilation of mailparse as mentioned just after step 7. However, for it to work successfully, this will not function. Since all commands in “/etc/php.d” or any other place where mbstring.ini is present are initiated in processes after /etc/php.ini and not before it whereas mailparse will give an error because the simple addition of string is processing the directives ahead of mbstring in /etc/php.ini.
  • Without going through with step 9, initiating mbstring in /etc/php.ini ahead of mailparse will prompt double loading of mbstring (in /etc/php.ini and in /etc/php.d/mbstring.ini). As a result, whenever you launch PHP you will be bombarded with warnings.
  • Be careful with the httpd concerned things if you are using PHP without Apache, for CLI.
  • There are two methods to avoid facing the trouble mentioned in the first point for tips:
    • Either rename the mailparse ini file so that it loads after mbstring depending upon PHP loading technique.
    • Or introduce extension=mailparse.so in the mbstring ini file ahead of extension=mbstring.so.

 

Note: You need to have a few things installed before you proceed with this process. To install, use ‘yum install <package-name>’ and to test use ‘rpm -q <package-name>’:

  • php
  • httpd (optional)
  • php-devel
  • php-mbstring
Share ThisFacebookTwitterGoogle+LinkedInRedditStumbleUpontumblr
About the Author

MaddyAcca is a blogger and SEO consultant and loves to write articles on technology. He has done his qualification from a well reputed collage. Let's be friends on Google+, Facebook and Twitter Now.