TurnipEntropy
TurnipEntropy

Reputation: 527

Change which libxml2 version PHP uses

A little bit of intro. I'm using xmlrpc_server_call_method to parse through an XML request and perform the action specified in the XML on the data contained in the XML. The XMLs I need to process are larger than 10MB, largely due to one extremely long line of text and so I need to compile libxml2 with a modified parserInternals.h file. I have successfully compiled libxml2 and got the libxml2.so, libxml2.so.2, and libxml2.so.2.9.7 files as a result.

The problem I'm having is getting PHP to recognize those as the libxml2.so to use. Do I have to compile php-xmlrpc as well? I've replaced every libxml2.so on my server with the new libxml2.so's, and PHP still thinks there is a 2.9.1 somewhere on my system (according to phpinfo()).

Also, ldconfig shows libxml2.so.2 -> libxml2.so.2.9.7, but doesn't show libxml2.so at all.

The output of ldd xmlrpc.so:

libxml2.so.2 => /lib64/libxml2.so.2 (memory address goes here)

/lib64 is linked to /usr/lib64, and the libxml2.so.2 in that directory links to libxml2.so.2.9.7, the result of compiling the modified libxml2.

Thanks

Upvotes: 2

Views: 1890

Answers (1)

TurnipEntropy
TurnipEntropy

Reputation: 527

I had to manually remake the symbolic links. They were pointing to the correct place, but for some reason php-fpm in /proc/pid/map_files/blah still had symbolic links to libxml2.so.2.9.1, even after a restart with systemctl restart rh-php56-php-fpm. I remade the symbolic links with ln -sf libxml2.so.2.9.7 libxml2.so.2 and restarted the php-fpm service again, and voila.

Thank you to GhostGambler for teaching me about ldd. That was a very helpful lesson.

EDIT: For reference, I used the following command to find out if there were processes still using the older libxml2 library:

find / -exec ls -ald {} ';' 2>/dev/null | grep '\-> /path/to/library_of_interest.so'

This is slow... so it's better to just start in /proc and be patient.

Upvotes: 1

Related Questions