5

Recently upgraded PHP and ran into the following error message while updating:

php_msgpack_serialize in Unknown on line 0

So first of all, never heard of this package. All searches for this package leads to a single PECL repo (which really doesn't mean anything either) - which has about zero mentions from the community.

A few more searches and I tracked the origin down to a repo for php-memcached-dev - a repository I've never seen or heard of.

Of course, I have heard of the actual memcached library repo: libmemcached

I tried looking for this module everywhere for a sign of it being a legit part of centos but i can't seem to get any good/reliable results.

Places I searched for any sign of this package and/or repository:

I don't want to seem paranoid here, but I'm not even sure if this is legit at this stage.

Shrug - I dunno. I'm keeping my server turned off though until I see something else. Anyone have some advice/input ?

For the paranoid (and yes, I found it from being a little bit myself), here is an ugly google search : php_msgpack backdoor (note: only has 2 3 search results. Check out the date in the 2nd 3rd. i haven't clicked it myself and would not recommend anyone else click it either) This seems to be a rkhunter search looking for the same file being reported above. Probably just a coincidence but who knows. Thought I'd push it out there anyways.

UPDATE: Well, long story short this turned out to be an issue with a version of PHP that was installed with Cent. It has been fixed with the latest version.

6 Answers 6

8

On Ubunu 16.04 with PHP 5.5 from the Ondrej-PPA (https://launchpad.net/~ondrej/+archive/ubuntu/php) I could solve the problem by installing the package php-msgpack:

sudo apt-get install php-msgpack

And than enabling the php-msgpack with

sudo phpenmod msgpack

Perhaps you ave to restart apache2 after that if you use it with PHP.

Than this error is gone:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20121212/memcached.so' - /usr/lib/php/20121212/memcached.so: undefined symbol: php_msgpack_serialize in Unknown on line 0

Sign up to request clarification or add additional context in comments.

4 Comments

Oh God. This worked. Please explain why this works!?
Because the missing file comes with this library.
Its unreal to me (but very common to php in my experience) that they would release a package (memcached) without including an external dependency. It seems like bad practice to release a library and not include all the required files it needs to run. No it doesn't seem like bad practice, it IS bad practice.
I had this same problem too on MAMP (pro), just enable the msgpack.so extension too and you should be good to go.
5

One last thing to check: msgpack extension must be loaded before memcached.

In my scenario extensions were loaded alphabetically and therefore memcached was loaded before msgpack. Php cli didn't work until I loaded msgpack before memcached.

1 Comment

Same for me. Had to modify /etc/php/<version>/mods-available/msgpack.ini to change in it : priority=20 to priority=15. Then phpdismod msgpack and phpenmod msgpack
2

Following commands solved my issue.

sudo apt-get install php-igbinary

sudo apt-get install php-msgpack

sudo service php7.3-fpm reload #Change to your version

Reference: https://laracasts.com/discuss/channels/forge/php-71-update-broken-memcached

Comments

2

If you land here in Oct 2020 because you're getting an error after upgrading and you're using the repository ppa:ondrej/php you need to install the specific version of msgpack because all-of-a-sudden memcached is looking for this shared object.

We're running php 7.3 from this repo and although php-msgpack was installed, we needed to install php7.3-msgpack (which wasn't needed until this upgrade). No need to "enable" it as mentioned in the accepted answer. Just restart php.

Two steps:

sudo apt install php7.3-msgpack
sudo systemctl restart php7.3-fpm.service

Comments

0

If your codebase doesn't use MsgPack, you can remove it from the php.ini and/or smaller files that mention it in the php.d/* subdirectories.

1 Comment

That's cool - I think I was just wondering more of if this was a known package in centos - to satisfy my curiosity. has msgpack always been in php.ini? i don't think i ever noticed it before
0

Well, long story short this turned out to be an issue with a version of PHP that was installed with Cent. It has been fixed with the latest version.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.