Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does PHPinfo have a header version and library version? What are the differences?

Tags:

php

openssl

I have an inconsistency, and I could not align their versions properly, so I just wanted to remove the library version. Can I do this? Is the header version for PHP while the library is from my distro? Can I upgrade PHP's library version? If so, how? I am using PHP 5.4.4

For example, phpinfo

like image 269
Strawberry Avatar asked Jul 15 '12 19:07

Strawberry


4 Answers

Is the header version for PHP while the library is from my distro?

It means it was compiled against the 1.0.1 headers, but is now dynamically linking against 0.9.8. So you are using an older version than what was used when PHP was compiled.

Many libraries store the version in the header files. So when a program uses the library, it can do something like int HEADER_FOO_VERSION = LIBRARY_VERSION, which embeds that version number into the program (e.g., php). Now when that program runs, it links dynamically against the library, which may be a different one than was on the host system.

That library may have a function call, say int get_library_version(). So the program (PHP) can check if HEADER_FOO_VERSION == get_library_version(). If it's different, then there could be a compatibility issue. (Of course, it doesn't have to be assign to a local variable... I'm just trying to drive home the point that the header version number can be compiled into php, and remains constant no matter which version of the library is being used at run time.)

Whether or not it is a problem depends on if the two versions are compatible.

Usually if the library is > than the header, you are okay. It's definitely more likely to be a problem if the library is older than the version it was linked against. Of course, this is because it's impossible to know what changes future versions may have.

So in your case, I would try to update your system's SSL libraries via apt-get, yum, etc, to match the version PHP is expecting.

To check which version php is using on Linux:

$ ldd `which php` | grep ssl
  libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0

Note that which php is just a short-cut to find the full path. You can hard code any executable you'd like to check: ldd /usr/sbin/httpd.

like image 193
Matthew Avatar answered Nov 10 '22 09:11

Matthew


I dont know the answer myself, but when searched on google some nice resources explaining the same.....

What's the difference between a header file and a library?

The version of the files are the one mentioned in the phpinfo used to create a library.

Hope it helps, there are lot of resource available if searched on google.

Still will like to hear from someone in great details about the question

like image 23
swapnilsarwe Avatar answered Nov 10 '22 10:11

swapnilsarwe


The header version is the functionality version, whereas the library version is the code version.

The header defines the interface - it tells you what functions are within the library. If a header gets updated, then you need to check to make sure all the functions are the same, and see if any are added or subtracted.

But if a library gets updated, and not the header, it means all the function calls are the same, but some of the code may be changed (eg, bug fixes).

In your example, PHP is seeing functionality for OpenSSL 1.0.1, but the actual version of the source code that OpenSSL is loading is 0.9.8o

like image 24
cegfault Avatar answered Nov 10 '22 10:11

cegfault


This is commonly seen on updated versions of openssl. What happens is the newer versions for the libraries are stored in different folder. The original folder located at /usr/bin/openssl would need a symbolic link to the new folder /usr/local/bin/openssl. That would get both to be the same version or just show OpenSSL Version _(Whatever)

Normally there is no concern for this, since it still works the way it is intended. This is seen a lot on shared servers.

EDIT:

The information in this post is generic and can be different if you are running
CentOS, RedHat, Ubuntu, or another Linux/BSD version. Check documentation or man
pages for the best information

If you do update your OpenSSL, some versions of *nix Require for you to rebuild PHP and Apache for it to update

like image 30
James Williams Avatar answered Nov 10 '22 09:11

James Williams