2

I am putting this question basically because I want to use PHP: Mailparse extension and stuck in its installation. But, I also want to know some basics of PHP extension installation - Please check bottom - Basic Question regarding extension installation. This may be a silly question but I still have lots of confusion in these things and always get stuck at important times. So please excuse me and help me if you can

I tried the following methods to install Mailparse extension -

Recompiling PHP
I tried to go for recompiling PHP with mailparse extension but I am unable to do that so far - check https://serverfault.com/questions/227976/on-which-location-to-run-configure-while-recompiling-php.

PECL command install
I was thinking since it is a PECL extension, could it be installed through pecl install mailparse command? On running that command it starts the process -

downloading mailparse-2.1.5.tgz ...
Starting to download mailparse-2.1.5.tgz (37,332 bytes)
..........done: 37,332 bytes
9 source files, building
running: phpize
grep: /opt/lampp/include/php/main/php.h: No such file or directory
grep: /opt/lampp/include/php/Zend/zend_modules.h: No such file or directory

But I finally get this in the end and it fails -

...
...
/tmp/pear/temp/mailparse/php_mailparse.h:113: error: declaration for parameter 'def_charset' but no such parameter
/tmp/pear/temp/mailparse/mailparse.c:1540: error: expected '{' at end of input
make: *** [mailparse.lo] Error 1
ERROR: `make' failed

Downloading mailparse package
Also, they provide mailparse package download option here http://pecl.php.net/package/mailparse. I downloaded it but not sure where to put it and how to install it.

Basic Question regarding extension installation
So, are all these methods of installing an extension valid? If so why do they say in PHP: Mailparse extension that -

In order to use these functions you must compile PHP with mailparse support by using the --enable-mailparse configure option.

Is it because this extension has been moved to the PECL repository. For other PHP extensions which are not moved to PECL repository is it mandatory to recompile PHP?

Thanks

Sandeepan Nath
  • 617
  • 6
  • 13
  • 27

1 Answers1

1

Your best option is to install the PECL package as you were doing, the problem you have there is that you're missing the php headers, they're necessary for any compilation involving php code.

Try downloading the headers (available in the source code package) and copying them were PECL is complaining until you get your PECL module compiled.

Best of lucks! This is an exciting task :)

lynxman
  • 9,157
  • 3
  • 24
  • 28
  • you are correct. I had manually renamed the existing xampp installation and did a fresh extract of xampp. Now I copied the contents of the include dir inside that xampp into the working xampp installation and it worked. – Sandeepan Nath Jan 28 '11 at 12:26
  • If you could also answer my question "are all these methods of installing an extension valid?". And also http://serverfault.com/questions/227976/on-which-location-to-run-configure-while-recompiling-php Thanks – Sandeepan Nath Jan 28 '11 at 12:30
  • They look valid to me, the easiest one being PECL, but if you require so you can recompile your php as well. The other options you point out are just packaging and requirements for compilation. I guess you could also get the same functionality from PEAR depending on what you need, saves you from recompilations (http://pear.php.net). – lynxman Jan 28 '11 at 13:25