├── .gitignore ├── .travis.yml ├── EXPERIMENTAL ├── LICENSE ├── README.md ├── config.m4 ├── config.w32 ├── env.c ├── env.h ├── env.php ├── package.xml ├── php5 └── php_env.c ├── php7 └── php_env.c ├── php_env.h └── tests ├── 001.phpt ├── 002.ini ├── 002.phpt ├── 003.ini └── 003.phpt /.gitignore: -------------------------------------------------------------------------------- 1 | .deps 2 | *.lo 3 | *.la 4 | .libs 5 | acinclude.m4 6 | aclocal.m4 7 | autom4te.cache 8 | build 9 | config.guess 10 | config.h 11 | config.h.in 12 | config.h.in~ 13 | config.log 14 | config.nice 15 | config.status 16 | config.sub 17 | configure 18 | configure.in 19 | include 20 | install-sh 21 | libtool 22 | ltmain.sh 23 | Makefile 24 | Makefile.fragments 25 | Makefile.global 26 | Makefile.objects 27 | missing 28 | mkinstalldirs 29 | modules 30 | run-tests.php 31 | tests/*/*.diff 32 | tests/*/*.out 33 | tests/*/*.php 34 | tests/*/*.exp 35 | tests/*/*.log 36 | tests/*/*.sh 37 | .gdb_history 38 | /*.tgz 39 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | notifications: 4 | email: false 5 | 6 | sudo: false 7 | 8 | php: 9 | - 5.6 10 | - 5.5 11 | - 7.0 12 | 13 | env: 14 | global: 15 | - NO_INTERACTION=1 16 | 17 | before_script: 18 | - phpize 19 | - ./configure 20 | - make 21 | 22 | script: REPORT_EXIT_STATUS=1 php run-tests.php -p `which php` --show-diff -d extension=`pwd`/.libs/env.so -q 23 | 24 | after_failure: "cat tests/*.diff" 25 | 26 | -------------------------------------------------------------------------------- /EXPERIMENTAL: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/beberlei/env/de463804914b0cf875b5d60776b256b49c7f1515/EXPERIMENTAL -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright (c) 2015 Benjamin Eberlei 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # env 2 | 3 | [![Build Status](https://travis-ci.org/beberlei/env.svg)](https://travis-ci.org/beberlei/env) 4 | 5 | PHP extension that parses environment file on module startup and populates 6 | `getenv()` with this information. 7 | 8 | This allows you to easily propagate configuration values to *all* PHP executions, 9 | following the [12factor app on Config](http://12factor.net/config). 10 | 11 | Settings are loaded once, during PHP module startup. There is no additional 12 | file parsing necessary during requests, because data is put into the web 13 | servers environment variables using `setenv`. 14 | 15 | **EXPERIMENTAL** This extension is not tested in production yet. It currently 16 | works with PHP 5.5, 5.6 and PHP 7 on Non-ZTS builds of PHP. 17 | 18 | **Working and tested SAPIs:** 19 | 20 | - CLI 21 | - Apache2 22 | - PHP Builtin Server 23 | - PHP-FPM 24 | 25 | ## Installation 26 | 27 | Regular PHP extension installation procedure: 28 | 29 | $ phpize 30 | $ ./configure 31 | $ make 32 | $ sudo make install 33 | 34 | ## Configuration 35 | 36 | You configure a global configuration file that is used for all invocations of 37 | PHP through the CLI or any other SAPI (Apache, FPM) for every request. 38 | 39 | env.file=/etc/php5/.env 40 | 41 | ## Example 42 | 43 | With an `env.file=/etc/php5/.env` of the following contents: 44 | 45 | FOO=BAR 46 | 47 | You can access the information during a PHP request with: 48 | 49 | ```php 50 | getenv('DATABASE_DSN'); 74 | 75 | return $parameters; 76 | } 77 | 78 | private function getenv($name) 79 | { 80 | $value = getenv($name); 81 | 82 | if ($value === false) { 83 | throw new \RuntimeException(sprintf("Cannot build application: %s environment variable is missing.", $name)); 84 | } 85 | 86 | return $value; 87 | } 88 | } 89 | ``` 90 | 91 | 92 | ## Credits 93 | 94 | Inspiration and parts of the code are taken from laruences 95 | [yaconf](https://pecl.php.net/package/yaconf) extension. 96 | 97 | ## License 98 | 99 | MIT License 100 | -------------------------------------------------------------------------------- /config.m4: -------------------------------------------------------------------------------- 1 | PHP_ARG_ENABLE(env, whether to enable env support, 2 | [ --enable-env Enable env support]) 3 | 4 | if test "$PHP_ENV" != "no"; then 5 | AC_MSG_CHECKING(PHP version) 6 | export OLD_CPPFLAGS="$CPPFLAGS" 7 | export CPPFLAGS="$CPPFLAGS $INCLUDES" 8 | AC_TRY_COMPILE([#include ], [ 9 | #if PHP_MAJOR_VERSION > 5 10 | #error PHP > 5 11 | #endif 12 | ], [ 13 | subdir=php5 14 | AC_MSG_RESULT([PHP 5.x]) 15 | ], [ 16 | subdir=php7 17 | AC_MSG_RESULT([PHP 7.x]) 18 | ]) 19 | export CPPFLAGS="$OLD_CPPFLAGS" 20 | ENV_SOURCES="$subdir/php_env.c env.c" 21 | 22 | PHP_SUBST([LIBS]) 23 | PHP_SUBST([ENV_SHARED_ADD]) 24 | PHP_NEW_EXTENSION(env, $ENV_SOURCES, $ext_shared) 25 | fi 26 | -------------------------------------------------------------------------------- /config.w32: -------------------------------------------------------------------------------- 1 | // $Id$ 2 | // vim:ft=javascript 3 | 4 | // If your extension references something external, use ARG_WITH 5 | // ARG_WITH("env", "for env support", "no"); 6 | 7 | // Otherwise, use ARG_ENABLE 8 | // ARG_ENABLE("env", "enable env support", "no"); 9 | 10 | if (PHP_ENV != "no") { 11 | EXTENSION("env", "env.c"); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /env.c: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Version 5 | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2015 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | /* $Id$ */ 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include "config.h" 23 | #endif 24 | 25 | #include "php.h" 26 | #include "php_ini.h" 27 | #include "ext/standard/info.h" 28 | #include "php_env.h" 29 | #include "env.h" 30 | 31 | ZEND_DECLARE_MODULE_GLOBALS(env) 32 | 33 | /* True global resources - no need for thread safety here */ 34 | static int le_env; 35 | 36 | /* {{{ PHP_INI 37 | */ 38 | PHP_INI_BEGIN() 39 | STD_PHP_INI_ENTRY("env.file", "", PHP_INI_ALL, OnUpdateString, file, zend_env_globals, env_globals) 40 | PHP_INI_END() 41 | /* }}} */ 42 | 43 | 44 | void char_ptr_dtor(char **str) 45 | { 46 | free(*str); 47 | } 48 | 49 | /* {{{ PHP_GINIT_FUNCTION 50 | */ 51 | PHP_GINIT_FUNCTION(env) 52 | { 53 | env_globals->file = NULL; 54 | env_globals->parse_err = 0; 55 | env_globals->vars = (HashTable*)pemalloc(sizeof(HashTable), 1); 56 | zend_hash_init(env_globals->vars, 128, NULL, (dtor_func_t)char_ptr_dtor, 1); 57 | } 58 | /* }}} */ 59 | 60 | /* {{{ PHP_GSHUTDOWN_FUNCTION 61 | */ 62 | PHP_GSHUTDOWN_FUNCTION(env) 63 | { 64 | env_globals->file = NULL; 65 | env_globals->parse_err = 0; 66 | zend_hash_destroy(env_globals->vars); 67 | free(env_globals->vars); 68 | } 69 | 70 | /* {{{ PHP_MINIT_FUNCTION 71 | */ 72 | PHP_MINIT_FUNCTION(env) 73 | { 74 | REGISTER_INI_ENTRIES(); 75 | 76 | php_env_module_init(ENV_G(vars) TSRMLS_CC); 77 | 78 | return SUCCESS; 79 | } 80 | /* }}} */ 81 | 82 | /* {{{ PHP_MSHUTDOWN_FUNCTION 83 | */ 84 | PHP_MSHUTDOWN_FUNCTION(env) 85 | { 86 | UNREGISTER_INI_ENTRIES(); 87 | 88 | return SUCCESS; 89 | } 90 | /* }}} */ 91 | 92 | /* Remove if there's nothing to do at request start */ 93 | /* {{{ PHP_RINIT_FUNCTION 94 | */ 95 | PHP_RINIT_FUNCTION(env) 96 | { 97 | php_env_request_init(ENV_G(vars) TSRMLS_CC); 98 | 99 | return SUCCESS; 100 | } 101 | /* }}} */ 102 | 103 | /* Remove if there's nothing to do at request end */ 104 | /* {{{ PHP_RSHUTDOWN_FUNCTION 105 | */ 106 | PHP_RSHUTDOWN_FUNCTION(env) 107 | { 108 | return SUCCESS; 109 | } 110 | /* }}} */ 111 | 112 | /* {{{ PHP_MINFO_FUNCTION 113 | */ 114 | PHP_MINFO_FUNCTION(env) 115 | { 116 | php_info_print_table_start(); 117 | php_info_print_table_header(2, "env support", "enabled"); 118 | php_info_print_table_end(); 119 | 120 | DISPLAY_INI_ENTRIES(); 121 | } 122 | /* }}} */ 123 | 124 | /* {{{ env_functions[] 125 | * 126 | * Every user visible function must have an entry in env_functions[]. 127 | */ 128 | const zend_function_entry env_functions[] = { 129 | PHP_FE_END /* Must be the last line in env_functions[] */ 130 | }; 131 | /* }}} */ 132 | 133 | /* {{{ env_module_entry 134 | */ 135 | zend_module_entry env_module_entry = { 136 | STANDARD_MODULE_HEADER, 137 | "env", 138 | env_functions, 139 | PHP_MINIT(env), 140 | PHP_MSHUTDOWN(env), 141 | PHP_RINIT(env), /* Replace with NULL if there's nothing to do at request start */ 142 | PHP_RSHUTDOWN(env), /* Replace with NULL if there's nothing to do at request end */ 143 | PHP_MINFO(env), 144 | PHP_ENV_VERSION, 145 | PHP_MODULE_GLOBALS(env), /* globals descriptor */ 146 | PHP_GINIT(env), /* globals ctor */ 147 | PHP_GSHUTDOWN(env), /* globals dtor */ 148 | NULL, /* post deactivate */ 149 | STANDARD_MODULE_PROPERTIES_EX 150 | }; 151 | /* }}} */ 152 | 153 | #ifdef COMPILE_DL_ENV 154 | ZEND_GET_MODULE(env) 155 | #endif 156 | 157 | /* 158 | * Local variables: 159 | * tab-width: 4 160 | * c-basic-offset: 4 161 | * End: 162 | * vim600: noet sw=4 ts=4 fdm=marker 163 | * vim<600: noet sw=4 ts=4 164 | */ 165 | -------------------------------------------------------------------------------- /env.h: -------------------------------------------------------------------------------- 1 | #ifndef ENV_H 2 | #define ENV_H 3 | void php_env_module_init(HashTable *vars TSRMLS_DC); 4 | void php_env_request_init(HashTable *vars TSRMLS_DC); 5 | #endif 6 | -------------------------------------------------------------------------------- /env.php: -------------------------------------------------------------------------------- 1 | "; 3 | 4 | if(!extension_loaded('env')) { 5 | dl('env.' . PHP_SHLIB_SUFFIX); 6 | } 7 | $module = 'env'; 8 | $functions = get_extension_funcs($module); 9 | echo "Functions available in the test extension:$br\n"; 10 | foreach($functions as $func) { 11 | echo $func."$br\n"; 12 | } 13 | echo "$br\n"; 14 | $function = 'confirm_' . $module . '_compiled'; 15 | if (extension_loaded($module)) { 16 | $str = $function($module); 17 | } else { 18 | $str = "Module $module is not compiled into PHP"; 19 | } 20 | echo "$str\n"; 21 | ?> 22 | -------------------------------------------------------------------------------- /package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | env 4 | pecl.php.net 5 | Load environment variables into PHP from a global configuration file 6 | Based on 12Factor Application rules this extension allows you to load environment variables into every PHP request, in every SAPI using a global configuration file with key value pairs of environment variables. 7 | 8 | Benjamin Eberlei 9 | beberlei 10 | beberlei@php.net 11 | yes 12 | 13 | 2016-01-01 14 | 15 | 16 | 0.2.0 17 | 0.2.0 18 | 19 | 20 | beta 21 | beta 22 | 23 | MIT 24 | 25 | - Reset env variables before every RINIT to allow usage in PHP-FPM 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 5.5.0 54 | 55 | 56 | 1.4.0 57 | 58 | 59 | 60 | env 61 | 62 | 63 | 64 | 2016-01-01 65 | 66 | 0.2.0 67 | 0.2.0 68 | 69 | 70 | beta 71 | beta 72 | 73 | MIT 74 | 75 | - Reset env variables before every RINIT to allow usage in PHP-FPM 76 | 77 | 78 | 79 | 2015-12-31 80 | 81 | 0.1.0 82 | 0.1.0 83 | 84 | 85 | beta 86 | beta 87 | 88 | MIT 89 | 90 | - Initial release 91 | 92 | 93 | 94 | 95 | 98 | -------------------------------------------------------------------------------- /php5/php_env.c: -------------------------------------------------------------------------------- 1 | #include "php.h" 2 | #include "../php_env.h" 3 | #include "../env.h" 4 | 5 | ZEND_DECLARE_MODULE_GLOBALS(env) 6 | 7 | static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, HashTable *ht) /* {{{ */ { 8 | zval *rv; 9 | char *str; 10 | 11 | TSRMLS_FETCH(); 12 | 13 | if (ENV_G(parse_err)) { 14 | return; 15 | } 16 | 17 | if (value == NULL) { 18 | return; 19 | } 20 | 21 | if (callback_type == ZEND_INI_PARSER_ENTRY && Z_TYPE_P(value) == IS_STRING) { 22 | str = strndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); 23 | zend_symtable_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key)+1, &str, sizeof(char*), NULL); 24 | } else if (callback_type == ZEND_INI_PARSER_SECTION || callback_type == ZEND_INI_PARSER_POP_ENTRY) { 25 | ENV_G(parse_err) = 1; 26 | } 27 | } 28 | 29 | void php_env_module_init(HashTable *vars TSRMLS_DC) { 30 | int ndir = 255; 31 | unsigned char c; 32 | zend_file_handle fh = {0}; 33 | 34 | if (ENV_G(file) != NULL && strlen(ENV_G(file)) > 0 && VCWD_ACCESS(ENV_G(file), F_OK) == 0) { 35 | if ((fh.handle.fp = VCWD_FOPEN(ENV_G(file), "r"))) { 36 | fh.filename = ENV_G(file); 37 | fh.type = ZEND_HANDLE_FP; 38 | 39 | if (zend_parse_ini_file(&fh, 0, 0, (zend_ini_parser_cb_t)php_env_ini_parser_cb, vars TSRMLS_CC) == FAILURE || ENV_G(parse_err)) { 40 | if (ENV_G(parse_err)) { 41 | php_error(E_WARNING, "env: parsing '%s' failed", ENV_G(file)); 42 | } 43 | ENV_G(parse_err) = 0; 44 | } 45 | } 46 | } 47 | } 48 | 49 | void php_env_request_init(HashTable *vars TSRMLS_DC) 50 | { 51 | char *str; 52 | uint len; 53 | ulong idx; 54 | int type; 55 | char **data; 56 | 57 | for (zend_hash_internal_pointer_reset(vars); 58 | zend_hash_has_more_elements(vars) == SUCCESS; 59 | zend_hash_move_forward(vars)) { 60 | 61 | type = zend_hash_get_current_key_ex(vars, &str, &len, &idx, 0, NULL); 62 | if (type == HASH_KEY_IS_STRING) { 63 | if ((zend_hash_get_current_data(vars, (void**)&data) == SUCCESS)) { 64 | setenv(str, *data, 1); 65 | } 66 | } 67 | } 68 | } 69 | /* 70 | * Local variables: 71 | * tab-width: 4 72 | * c-basic-offset: 4 73 | * End: 74 | * vim600: noet sw=4 ts=4 fdm=marker 75 | * vim<600: noet sw=4 ts=4 76 | */ 77 | -------------------------------------------------------------------------------- /php7/php_env.c: -------------------------------------------------------------------------------- 1 | #include "php.h" 2 | #include "../php_env.h" 3 | #include "../env.h" 4 | 5 | ZEND_DECLARE_MODULE_GLOBALS(env) 6 | 7 | static void php_env_ini_parser_cb(zval *key, zval *value, zval *index, int callback_type, void *arg) /* {{{ */ { 8 | HashTable *ht = (HashTable*)arg; 9 | char *str; 10 | 11 | if (ENV_G(parse_err)) { 12 | return; 13 | } 14 | 15 | if (value == NULL) { 16 | return; 17 | } 18 | 19 | if (callback_type == ZEND_INI_PARSER_ENTRY) { 20 | str = strndup(Z_STRVAL_P(value), Z_STRLEN_P(value)); 21 | zend_hash_update_mem(ht, Z_STR_P(key), str, sizeof(char*)); 22 | } else if (callback_type == ZEND_INI_PARSER_SECTION || callback_type == ZEND_INI_PARSER_POP_ENTRY) { 23 | ENV_G(parse_err) = 1; 24 | } 25 | } 26 | 27 | void php_env_module_init(HashTable *vars TSRMLS_DC) { 28 | int ndir = 255; 29 | uint32_t i; 30 | unsigned char c; 31 | struct zend_stat sb; 32 | zend_file_handle fh = {0}; 33 | 34 | if (ENV_G(file) != NULL && strlen(ENV_G(file)) > 0 && VCWD_STAT(ENV_G(file), &sb) == 0) { 35 | if (S_ISREG(sb.st_mode)) { 36 | if ((fh.handle.fp = VCWD_FOPEN(ENV_G(file), "r"))) { 37 | fh.filename = ENV_G(file); 38 | fh.type = ZEND_HANDLE_FP; 39 | 40 | if (zend_parse_ini_file(&fh, 0, 0 /* ZEND_INI_SCANNER_NORMAL */, 41 | php_env_ini_parser_cb, vars) == FAILURE || ENV_G(parse_err)) { 42 | if (ENV_G(parse_err)) { 43 | php_error(E_WARNING, "env: parsing '%s' failed", ENV_G(file)); 44 | } 45 | 46 | ENV_G(parse_err) = 0; 47 | } 48 | } 49 | } 50 | } 51 | } 52 | 53 | void php_env_request_init(HashTable *vars TSRMLS_DC) 54 | { 55 | zend_string *str; 56 | uint len; 57 | ulong idx; 58 | zval *val; 59 | 60 | ZEND_HASH_FOREACH_KEY_VAL(vars, idx, str, val) { 61 | if (str) { 62 | setenv(ZSTR_VAL(str), Z_PTR_P(val), 1); 63 | } 64 | } ZEND_HASH_FOREACH_END(); 65 | } 66 | /* 67 | * Local variables: 68 | * tab-width: 4 69 | * c-basic-offset: 4 70 | * End: 71 | * vim600: noet sw=4 ts=4 fdm=marker 72 | * vim<600: noet sw=4 ts=4 73 | */ 74 | -------------------------------------------------------------------------------- /php_env.h: -------------------------------------------------------------------------------- 1 | /* 2 | +----------------------------------------------------------------------+ 3 | | PHP Version 5 | 4 | +----------------------------------------------------------------------+ 5 | | Copyright (c) 1997-2015 The PHP Group | 6 | +----------------------------------------------------------------------+ 7 | | This source file is subject to version 3.01 of the PHP license, | 8 | | that is bundled with this package in the file LICENSE, and is | 9 | | available through the world-wide-web at the following url: | 10 | | http://www.php.net/license/3_01.txt | 11 | | If you did not receive a copy of the PHP license and are unable to | 12 | | obtain it through the world-wide-web, please send a note to | 13 | | license@php.net so we can mail you a copy immediately. | 14 | +----------------------------------------------------------------------+ 15 | | Author: | 16 | +----------------------------------------------------------------------+ 17 | */ 18 | 19 | /* $Id$ */ 20 | 21 | #ifndef PHP_ENV_H 22 | #define PHP_ENV_H 23 | 24 | extern zend_module_entry env_module_entry; 25 | #define phpext_env_ptr &env_module_entry 26 | 27 | #define PHP_ENV_VERSION "0.2.0" 28 | 29 | #ifdef PHP_WIN32 30 | # define PHP_ENV_API __declspec(dllexport) 31 | #elif defined(__GNUC__) && __GNUC__ >= 4 32 | # define PHP_ENV_API __attribute__ ((visibility("default"))) 33 | #else 34 | # define PHP_ENV_API 35 | #endif 36 | 37 | #ifdef ZTS 38 | #include "TSRM.h" 39 | #endif 40 | 41 | ZEND_BEGIN_MODULE_GLOBALS(env) 42 | HashTable *vars; 43 | char *file; 44 | int parse_err; 45 | ZEND_END_MODULE_GLOBALS(env) 46 | 47 | #ifdef ZTS 48 | #define ENV_G(v) TSRMG(env_globals_id, zend_env_globals *, v) 49 | #else 50 | #define ENV_G(v) (env_globals.v) 51 | #endif 52 | 53 | #endif /* PHP_ENV_H */ 54 | 55 | /* 56 | * Local variables: 57 | * tab-width: 4 58 | * c-basic-offset: 4 59 | * End: 60 | * vim600: noet sw=4 ts=4 fdm=marker 61 | * vim<600: noet sw=4 ts=4 62 | */ 63 | -------------------------------------------------------------------------------- /tests/001.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Check for env presence 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | env.file=/etc/php/.env 7 | --FILE-- 8 | 12 | --EXPECT-- 13 | env extension is available 14 | /etc/php/.env 15 | -------------------------------------------------------------------------------- /tests/002.ini: -------------------------------------------------------------------------------- 1 | FOO=BAR 2 | -------------------------------------------------------------------------------- /tests/002.phpt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | env: Load simple INI file 3 | --SKIPIF-- 4 | 5 | --INI-- 6 | env.file={PWD}/002.ini 7 | variables_order=EGPCS 8 | --FILE-- 9 | 5 | --INI-- 6 | env.file={PWD}/003.ini 7 | --FILE-- 8 |