Oliver Jane
Oliver Jane

Reputation: 158

attempting to run PHP returns php: symbol lookup error: php: undefined symbol: pcre2_set_depth_limit_8

I have installed PHP 7.4 through APT, but every time I try to run it, I receive the following error message:

php: symbol lookup error: php: undefined symbol: pcre2_set_depth_limit_8

running the command

ldd /usr/bin/php7.4 | grep pcre2

returns

libpcre2-8.so.0 => /usr/local/lib/libpcre2-8.so.0 (0x00007fa00625e000) 

running the command

nm -gD /usr/local/lib/libpcre2-8.so.0 | grep depth

returns nothing, showing that the library does not contain the symbol. However, the library located in

/usr/lib/x86_64-linux-gnu/libpcre2-8.so.0

does contain the symbol. Running ldconfig -v does not appear to have any effect.

Note: I am using PHP, not PHP-fpm

I am using Ubuntu 21.04.

Upvotes: 1

Views: 3509

Answers (2)

This one helped in my case,

sudo update-alternatives --set php /usr/bin/php7.4

Upvotes: 0

Oliver Jane
Oliver Jane

Reputation: 158

Removing the symlink in /usr/local/lib/libpcre2-8.so.0 and replacing it to point to /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 seems to resolve this problem. Hope this helps anyone facing the same issue.

Upvotes: 2

Related Questions