User Tools

Site Tools


computing:frameworks:php:extension

PHP extension

This page is about the development of PHP extension in C++.

The official documentation about extensions on the official PHP web site is only about PHP 5, not PHP 7. The examples may compile properly under PHP 7, but they will not work properly.

See http://wiki.php.net/phpng-upgrading.

Installation

Compilation

In the C/C++ source files you may found on the web, if there is a compilation error on function_entry, replace it with zend_function_entry.

Macros

Windows

Macros definitions which seems to be needed for compilation under Windows :

  • ZEND_WIN32_FORCE_INLINE,
  • ZEND_WIN32=1,
  • PHP_WIN32=1,
  • __STDC_LIMIT_MACROS,
  • ZEND_DEBUG=0,
  • ZTS.

The last one is only needed to compile in TS mode, not for the NTS mode.

Linking

Windows

You have to link against <php>/Release_TS/php5ts.lib (obviously for the thread-safe version).

Activation

You have to :

  • create a .ini file in /etc/php5/mods-available which contains extension=<extension-name>.<libext>, <libext> being the dynamic library extension for the concerned OS,
  • launch as root php5enmod <extension_name>.

In order for the extension yo be recognized, verify that :

  • the extension correspondent library <extension_name>.<libext> is present in the extension directory,
  • there is a .ini file in the /etc/php5/mods-available directory which contains the line extension=<extension-name>.<libext>,
  • there is a link in the conf.d directory pointing to the above file.

Misc

  • For the directory of the extensions : php-config | grep extension,
  • for the .ini file php --ini.
computing/frameworks/php/extension.txt · Last modified: Wed Oct 11 15:01:40 2017 (11/10/17) by Claude SIMON