## Whether to Refer to PHP Extensions or to PHP Libraries

In This Earlier Posting, I wrote that the PHP5 packages I have installed, include extensions that allow the PHP Scripts to act as a MySQL Client.

I suppose that one picky question to ask might be, ‘Should those not be referred to as PHP Libraries?’ Unfortunately, the answer is not as cut-and-dry as that might sound.

The way these files work is similar to how ‘Java Native Includes’ work. It has frequently been possible to do ‘Multi-Language Programming’, in which some subroutines are programmed in C or in C++, but are made visible to the interpreted language – that being Java, Python, PHP, etc., so that they can be called from that parent context.

But AFAIK, the way JNIs are usually linked, it is that actual File belonging to the Java installation, that receives the object code, from what started out as C or C++ source code. Therefore, this File would correctly be the Library.

A regular Library would just be an .SO File in Linux, or a .DLL File under Windows, which contains this compiled code, that resulted from C or C++.

The hesitation that I see, before referring to PHP Libraries, is twofold:

1. The Modules were not themselves written in PHP.
2. The File in question depends on the .SO File, but does not contain the actual object code, which has been linked into that .SO File. Therefore, the actual package ‘php5-mysql‘ depends on the additional package ‘libmysqlclient18‘, but contains the files


/usr/lib/php5/20131226/mysql.so
/usr/lib/php5/20131226/mysqli.so
/usr/lib/php5/20131226/pdo_mysql.so

/usr/share/php5
/usr/share/php5/mysql
/usr/share/php5/mysql/mysql.ini
/usr/share/php5/mysql/mysqli.ini
/usr/share/php5/mysql/pdo_mysql.ini



OTOH, The package ‘libmysqlclient18‘ contains the files


/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18.0.0
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18
/usr/lib/x86_64-linux-gnu/libmysqlclient_r.so.18.0.0



What this means is that although the Files that actually belong to the PHP Package are linked as .SO Library Files, they merely act as a Wrapper for the files that do the work, and which were in the MySQL Clients Library Package, without which the PHP components could not work.

And so we do refer to these as “Bindings”, and I prefer to call them ‘Extensions’. The package manager refers to it as a “Module”.

Dirk