I have two php.ini
files -
/etc/php.ini
which loads in case of cli/opt/lampp/etc/php.ini
which loads in case of browser.
I am able to use PHP's Mailparse extension after adding the line extension=mailparse.so
in the /opt/lampp/etc/php.ini
and restarting lampp.
But I am not able to load the same in case of command line -
getting PHP Fatal error: Call to undefined function mailparse_msg_create() in ...
mailparse_msg_create() is a part of the Mailparse
extension.
I tried by relogging with the user after making the change and even restarting the system. What needs to be done so that the change takes effect.
Update
I checked that php -i | grep 'Configuration File'
gives
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mailparse.so' - /usr/lib/php/modules/mailparse.so: cannot open shared object file: No such file or directory in Unknown on line 0
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Update 2
I copied the mailparse.so from /opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
and put it in /usr/lib/php/modules
. I added extension=mailparse.so
to /etc/php.ini
as well. But it still showed this warning
PHP Warning: PHP Startup: Unable to load dynamic library ...
As told by Lekensteyn, I did
ldd /usr/lib/php/modules/mailparse.so
and got
ldd: warning: you do not have execution permission for /usr/lib/php/modules/mailparse.so'
So I gave execute permission. Then
ldd /usr/lib/php/modules/mailparse.so
showed
linux-gate.so.1 => (0x00110000) libc.so.6 => /lib/libc.so.6 (0x0011d000) /lib/ld-linux.so.2 (0x003aa000)
which looks normal. BUt now, running php
command says
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mailparse.so' - /usr/lib/php/modules/mailparse.so: undefined symbol: mbfl_name2no_encoding in Unknown on line 0
Have you installed the extension to where your command line version of PHP expects it to be?
Check
extension_dir
in your /etc/php.ini to see where it expects to find extensions and install the extension there or point it at your lampp PHP extensions directory (assuming it is a compatible version of PHP).Both php.ini's contains a different
extension_dir
setting,/etc/php.ini
seems to set it to/usr/lib/php/modules
and LAMPP sets it to/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
.To make Mailparse work for LAMPP, you need to copy mailparse.so to
/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626
and addextension=mailparse.so
to/opt/lampp/etc/php.ini
as well. As PHP loads the php.ini file each time run, there is no need to restart your computer.