11

I recompiled PHP 5.4.39 on my raspbian to include support for pthreads.
Everything works nice, even the pthreads, but every time I run a php script from commandline (and I guess it's the same if apache uses php), it says it's failing loading xcache.so:

Failed loading /usr/lib/php5/20100525+lfs/xcache.so: /usr/lib/php5/20100525+lfs/xcache.so: undefined symbol: compiler_globals

I recompiled php using this information: https://www.digitalocean.com/community/questions/enable-zts-support-on-ubuntu-14-04

Although php is running fine, I'd like to know what this message means and I'd like to solve it if possible.

Machavity
  • 30,841
  • 27
  • 92
  • 100
wullxz
  • 17,830
  • 8
  • 32
  • 51
  • you've got a library compiled against something that doesn't include `compiler_globals`. e.g. you've probably got a mishmash of original libaries and new ones from your own recompile. – Marc B May 05 '15 at 16:14
  • how do i track this down and fix this. i sadly have no clue... – wullxz May 05 '15 at 17:43
  • where does your extension come from (package manager or compiled from source or whatever) ? – n00dl3 Jun 18 '15 at 09:14
  • the sources are downoaded using `apt-get source php5` like described in the link to the tutorial I posted in my original post. – wullxz Jun 18 '15 at 09:35
  • Have you seen the following question (especially the answer): http://stackoverflow.com/questions/22201013/error-failed-loading-opcache-so-opcache-so-undefined-symbol-compiler-globals – VolenD Jun 18 '15 at 21:48

2 Answers2

6

You most likely have PHP extensions enabled that were built against an old build of PHP itself. The proper solution is to remove the incorrectly linked PHP extensions and rebuild them.

I suggest you start with the XCache extension (php5-xcache package on Ubuntu). Remove it and rebuild it by following the steps in the tutorial you mention (simply replace php5 with php5-xcache).

Most likely some other extensions will have issues too. Remove and rebuild them as well.

If you only followed the tutorial with php5 itself, it's safe to say you'll need to remove and rebuild all extensions. That's all packages starting with php5-.

PS: Not all PHP extensions support thread-safety. If you're unable to build a certain extension, but don't need it anyway, Simply uninstall it.

PPS: XCache is an opcode cache. Make sure you don't enable multiple opcode caches at the same time. For example, don't enable XCache and OPcache (or APC) together, but choose one.

Jasper N. Brouwer
  • 21,517
  • 4
  • 52
  • 76
  • thanks for your insights. as the website running on my raspberry won't be accessed very often, i guess i don't need an opcode cache. i uninstalled xcache now and the message is gone. if the website behaviour gets significantly slower, i can still reinstall a threadsafe-compiled version of xcache (i'll do it like you suggested: do the tutorial and replace php5 with php-xcache). – wullxz Jun 26 '15 at 02:49
  • btw: i guess xcache wasn't running anyway, am i right? ^^ – wullxz Jun 26 '15 at 02:51
  • The error can be boiled down to "Failed loading XCache", so you're right, XCache wasn't used :) – Jasper N. Brouwer Jun 26 '15 at 07:05
0

In php.ini search for zend_extension , do a sudo updatedb in another terminal and then locate xcache.so and that's the path you should put in php.ini. If that doesn't solve it, you may be using incompatible xcache module. i.e. Using thread safe xcache with non thread safe php or vice versa.

pinkal vansia
  • 10,240
  • 5
  • 49
  • 62