Install Mailparse in PHP Under Fedora

This describes the installation of the mailparse extension in PHP under Fedora. This extension is not an ordinary one, because it depends on the mbstring extension to be compiled, and they need to be loaded in the proper order for the installation to work properly. As such, this could be a template for other inter-dependent extensions as well.



All steps are intended to be performed from the command line as root (su -).

Steps

1.Go to (or create) a temporary directory and get the extension:
wget http://pecl.php.net/get/mailparse
You should end up with a file named mailparse-X.Y.Z.tgz, where X.Y.Z is the version.
Ad


2.Unpack the code:
tar zxf mailparse-X.Y.Z.tgz

(you obviously need to replace "X.Y.Z" with the proper version number, per above)

3.Go to the package directory:
cd mailparse-X.Y.Z

4.Prepare the package for compilation with your version of PHP:
phpize

5.Configure the package for compilation:
./configure

6.Compile:
make

7.Install:
make install

8.Find out where mbstring's ini file resides:
rpm -q -l php-mbstring

9.Look for an ini file in the output of the command above; edit that file and comment out the line reading "extension=mbstring.so" (prepend a semicolon)

10.Tell PHP that you want it to use extensions mbstring and mailparse in the proper order: edit file /etc/php.ini and add the following lines at the end of section Dynamic Extensions:
extension=mbstring.so
extension=mailparse.so

11.Restart Apache:
service httpd restart

12.(Optional) delete or clean up the temporary directory you created at step 1.

No comments :