What difference between extension, zend_extension, zend_extension_ts in PHP.ini (extension VS zend_extension)?

If you see in php.ini something like:

extension=php_pdo_sqlite.dll
zend_extension = php_xdebug-2.5.1-7.1-vc14.dll
;zend_extension_ts = php_xdebug-2.0.4.dll ;for PHP<=5.2

So,
extension – it’s native PHP extension
zend_extension – it’s Zend extension for PHP(mainly using for profiling/debug).
Both extension kinds share lots of stuff. The difference between both types is mainly in hooks they register into the Engine.
Remember that, despite it is very uncommon, an extension can be both a PHP extension and a Zend extension at the same time. Xdebug is a good example.

zend_extension_ts – it’s old(for PHP <5.3) threads safe Zend extension (not actual)
Detailed scheme of loading extension and zend_extension:


More detailed info you can read here: https://wiki.php.net/internals/extensions

If you catch: php5-imap requires ext-imap * -> the requested PHP extension imap is missing from your system.

If you see: “The requested PHP extension imap is missing from your system.”
It seems that you need to install imap extension on your system.
The following simple steps below:

apt-get install php5-imap

However, it’s not enabled IMAP by default so enable it with:

php5enmod imap

Then bounce apache:

service apache2 restart

If you got “IMAP extension must be enabled.” in PHP.
Continue reading If you catch: php5-imap requires ext-imap * -> the requested PHP extension imap is missing from your system.

How to get file extension on PHP?

There are some examples how to get file extensions via PHP.
Example 1. Quick, short, safe

function get_file_extension($file_name) {
return end(explode('.',$file_name));
}

Example 2 [PHP 5 >= 5.3.6]. SPL use

function get_file_extension($file_name) {
$file_info = new SplFileInfo($file_name);
return $file_info->getExtension();
?>

Example 3 [PHP 4 >= 4.0.3+]. Pathinfo use

function get_file_extension($file_name) {
return pathinfo($file_name, PATHINFO_EXTENSION);
?>