rfc:load-ext-by-name

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rfc:load-ext-by-name [2016/05/10 12:54]
francois created
rfc:load-ext-by-name [2018/03/01 23:23] (current)
carusogabriel RFC was implemented in PHP 7.2
Line 1: Line 1:
 ====== PHP RFC: Allow loading extensions by name ====== ====== PHP RFC: Allow loading extensions by name ======
-  * Version: 1.0 +  * Version: 1.1 
-  * Date: 2016-05-10+  * Date: 2017-06-01
   * Author: François Laupretre <​francois@php.net>​   * Author: François Laupretre <​francois@php.net>​
-  * Status: ​Under Discussion+  * Status: ​Implemented (in PHP 7.2)
   * First Published at: http://​wiki.php.net/​rfc/​load-ext-by-name   * First Published at: http://​wiki.php.net/​rfc/​load-ext-by-name
  
Line 9: Line 9:
 ===== Introduction ===== ===== Introduction =====
  
-This RFC proposes a portable ​way to configure the list of PHP extensions to load.+This RFC proposes a unified ​way to configure the list of PHP extensions to load.
  
 Today, '​extension='​ and '​zend_extension='​ lines in php.ini must contain the extension'​s file name. Today, '​extension='​ and '​zend_extension='​ lines in php.ini must contain the extension'​s file name.
-Unfortunately, ​this file name depends on the platform PHP is running on+Unfortunately, ​the filename ​depends on the platform PHP is running on :
-The situation is still worse on WIndows, where a '​php_'​ prefix must be added.+
  
-While seasoned PHP administrators are used to this mechanism, the issue remains +  ​On Unix-like environments, the file name has the form '<​extension-name>​.<​suffix>'​<​suffix> ​is '​so'​ on every systemexcept HP-UX, where it is '​sl'​. 
-when writing documentation,​ platform-agnostic scripts andmore generally, in +  - On Windows, the file name has the form '​php_<​extension-name>​.dll'​.
-every case where a unified syntax would allow using the same configuration ​file +
-in different environmentsThe typical example ​is +
-the coexistence of a Windows development environment and a Linux production. In +
-this case, it is currently impossible to write a single configuration file that will work +
-in both environmentsforcing developers to manually maintain two separate +
-versions of the file.+
  
-The issue is rather ​easy to solve because the logic to compute the file name +While seasoned PHP administrators are used to this mechanism, this is a real issue for newcomers. 
-corresponding to a given extension is well-known ​and easy to implement.+ 
 +Under Unix/Linux, the typical mistake is to uncomment an '​extension=php_xxx.dll'​ line in the php.ini file. 
 + 
 +On Windows, the situation for newcomers is still more confusing, as the distributed '​php.ini'​ files wrongly state that the Windows syntax is '​extension=modulename.extension',​ giving the wrong example of '​extension=mysqli.dll'​. Ten lines below, the '​.ini'​ file contains the right ';​extension=php_mysql.dll'​ syntax but these conflicting directives are very confusing. 
 + 
 +The issue may also appear when writing documentation and platform-agnostic scripts. 
 + 
 +To summarize, I think that a unified syntax to enable extensions on every environment would make the life easier for a lot of people, especially those coming to PHP. 
 + 
 +The issue is quite easy to solve because the logic to compute the file name 
 +from an extension ​name is well-known.
  
 ===== Proposal ===== ===== Proposal =====
  
-This RFC allows ​to load PHP and Zend extensions ​using the extension name instead +This RFC proposes an extension to the mechanism used to load PHP and Zend extensions. In addition to file names, it adds support for bare extension name. Note that the current syntax, using file names, remains ​supported as before.
-of the file name. File names remain ​supported as before.+
  
 Example : Example :
Line 40: Line 42:
  
 '​extension=bz2',​ for example, will cause PHP to load a file named '​php_bz2.dll'​ '​extension=bz2',​ for example, will cause PHP to load a file named '​php_bz2.dll'​
-on Windows, ​or a file named '​bz2.so'​ on Linux.+on Windows, a file named '​bz2.so'​ on Linux, and a file named '​bz2.sl'​ on HP-UX.
  
-Example php.ini files will be modified because loading extensions by name+Example php.ini files are modified because loading extensions by name
 becomes the recommended way of configuring additional extensions to load. becomes the recommended way of configuring additional extensions to load.
-File names remain supported ​and considered ​as legacy.+File names remain supported as legacy.
  
 Cases where the extension name is accepted : Cases where the extension name is accepted :
Line 50: Line 52:
   - '​extension='​ INI setting   - '​extension='​ INI setting
   - '​zend_extension='​ INI setting   - '​zend_extension='​ INI setting
-  - argument to the dl() function+  - as argument to the dl() function
  
 Cases where the extension name cannot be used : Cases where the extension name cannot be used :
  
   - The '​-z'​ CLI option still requires an absolute file path.   - The '​-z'​ CLI option still requires an absolute file path.
-  - When specifying an absolute path, a filename must be provided. A line like '​extension=/​path/​to/​extensions/​bz2'​ is invalid.+  - When specifying an absolute path, a filename must be provided. A line mixing a specific directory with an extension name, like '​extension=/​path/​to/​extensions/​bz2'​is invalid.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 62: Line 64:
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
-7.1+7.2
 ===== RFC Impact ===== ===== RFC Impact =====
 ==== To SAPIs ==== ==== To SAPIs ====
Line 83: Line 85:
  
 This RFC does not pretend solving every difference that may exist between This RFC does not pretend solving every difference that may exist between
-Windows and Unix configurationsWhere paths are set, the differences will remain. +Windows and Unix '.ini' ​configuration ​files.
-It allows to unify the configuration ​in the frequent cases where the only +
-difference is the '​extension=/​zend_extension='​ lines.+
  
 ===== Unaffected PHP Functionality ===== ===== Unaffected PHP Functionality =====
  
 The '​-z'​ CLI option does not support extension names. The '​-z'​ CLI option does not support extension names.
- 
-===== Future Scope ===== 
- 
-As it is possible to distinguish between PHP and Zend extensions at load time, 
-the '​zend_extension='​ keyword could be suppressed in favor of a single '​extension='​. 
-This is left for the future because specific constraints (like loading Zend 
-extensions always before PHP ones) make it quite complex to implement. 
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
 This RFC requires a 50%+1 majority. This RFC requires a 50%+1 majority.
 +
 +Vote is now closed. RFC is approved for inclusion in 7.2.
 +
 +<doodle title="​Allow loading extensions by name" auth="​francois"​ voteType="​single"​ closed="​true">​
 +   * Yes
 +   * No
 +</​doodle>​
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 107: Line 107:
  
 ===== Implementation ===== ===== Implementation =====
 +
 After the project is implemented,​ this section should contain ​ After the project is implemented,​ this section should contain ​
   - the version(s) it was merged to   - the version(s) it was merged to
rfc/load-ext-by-name.1462884853.txt.gz · Last modified: 2017/09/22 13:28 (external edit)