Add mailparse PHP module to CyberPanel

I recently needed to add the mailparse module to my server and I use CyberPanel as a control panel. So I looked into what needed to be done and it seems like it is really easy. There are extensions that can be installed in the panel, but this is not one of them. Any sort of PECL extension needs to be installed via the command line. Depending on what version of PHP you use for your website, these are the commands that needed to be run to install.

PHP 8.0

/usr/local/lsws/lsphp80/bin/pecl install mailparse

echo "extension=mailparse.so" >> /usr/local/lsws/lsphp80/etc/php/8.0/mods-available/30-mailparse.ini

PHP 8.1

/usr/local/lsws/lsphp81/bin/pecl install mailparse

echo "extension=mailparse.so" >> /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/30-mailparse.ini

PHP 8.2

/usr/local/lsws/lsphp82/bin/pecl install mailparse

echo "extension=mailparse.so" >> /usr/local/lsws/lsphp82/etc/php/8.2/mods-available/30-mailparse.ini

PHP 8.3

/usr/local/lsws/lsphp83/bin/pecl install mailparse

echo "extension=mailparse.so" >> /usr/local/lsws/lsphp83/etc/php/8.3/mods-available/30-mailparse.ini

Once you are done, you will need to restart the PHP version and then restart the LiteSpeed webserver with this command:

systemctl restart lsws

2 thoughts on “Add mailparse PHP module to CyberPanel”

  1. Thanks for this tutorial.
    Ive tried to install the PHP Mailparse extension on my cyberpanel isntallation.
    I am using PHP-81. but ive gt the following error after the first command.

    usr/local/lsws/lsphp81/bin/pecl install mailparse
    PHP Warning: PHP Startup: Unable to load dynamic library ‘mbstring’ (tried: /usr/local/lsws/lsphp81/lib/php/20210902/mbstring (/usr/local/lsws/lsphp81/lib/php/20210902/mbstring: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib/php/20210902/mbstring.so (/usr/local/lsws/lsphp81/lib/php/20210902/mbstring.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP Warning: PHP Startup: Unable to load dynamic library ‘exif’ (tried: /usr/local/lsws/lsphp81/lib/php/20210902/exif (/usr/local/lsws/lsphp81/lib/php/20210902/exif: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib/php/20210902/exif.so (/usr/local/lsws/lsphp81/lib/php/20210902/exif.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP Warning: PHP Startup: Unable to load dynamic library ‘mailparse.so’ (tried: /usr/local/lsws/lsphp81/lib/php/20210902/mailparse.so (/usr/local/lsws/lsphp81/lib/php/20210902/mailparse.so: cannot open shared object file: No such file or directory), /usr/local/lsws/lsphp81/lib/php/20210902/mailparse.so.so (/usr/local/lsws/lsphp81/lib/php/20210902/mailparse.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    PHP Warning: Module “imap” is already loaded in Unknown on line 0
    WARNING: channel “pecl.php.net” has updated its protocols, use “pecl channel-update pecl.php.net” to update
    downloading mailparse-3.1.6.tgz …
    Starting to download mailparse-3.1.6.tgz (945,937 bytes)
    ……………………………………………………………………………………………………………………………………………………………………..done: 945,937 bytes
    11 source files, building
    running: phpize
    Configuring for:
    PHP Api Version: 20210902
    Zend Module Api No: 20210902
    Zend Extension Api No: 420210902
    shtool at ‘/tmp/pear/temp/mailparse/build/shtool’ does not exist or is not executable.
    Make sure that the file exists and is executable and then rerun this script.

    ERROR: `phpize’ failed

    Any idea whats wrong ?

Leave a Reply to Christian Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.