rfc:moduleapi-inspection

PHP RFC: Module API Inspection

Introduction

Was asked at PHPBenelux about being able to tell what PHP version a given module is loadable in (given only the .so). Since the answer came down to “Try it and see if it works”, I thought something more formal would be nice.

Proposal

Add zend module api introspection to php-cli as two new command line switches

`--apino` option: Outputs PHP's compiled Zend Module API info:

$ sapi/cli/php --apino
ZEND_MODULE_API_NO: 20131227
ZEND_DEBUG:         enabled
ZTS:                enabled

`--modinfo /path/to/module.so` Options: Loads the .so (without attempting to register it as an extension) and output the corresponding Zend Module API info the module was compiled with.

$ sapi/cli/php --modinfo /usr/libexec/php/hello.so
ZEND_MODULE_API_NO: 20121212
ZEND_DEBUG:         disabled
ZTS:                disabled

Backward Incompatible Changes

Very old zend_module_entry versions have slightly different module headers. I addressed this by putting a bottom limit on the Zend Module API Version I'll look at which corresponds to 5.0. In earlier versions only the high-level API version number is shown.

Proposed PHP Version(s)

5.next

SAPIs Impacted

CLI

Unaffected PHP Functionality

This doesn't impact the engine or runtime at all. It's just a set of options for the command line sapi which dump some info and exit.

Implementation

rfc/moduleapi-inspection.txt · Last modified: 2018/06/18 10:19 by cmb