Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93165 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8665 invoked from network); 10 May 2016 19:18:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2016 19:18:27 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.162 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.162 mx206.easyname.com Received: from [212.232.25.162] ([212.232.25.162:40444] helo=mx206.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/E7-63163-10432375 for ; Tue, 10 May 2016 15:18:25 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1b0DAd-0002Ac-KV; Tue, 10 May 2016 19:18:15 +0000 Reply-To: internals@lists.php.net References: <59e5902d-004f-33b5-5d6f-991d89371e05@php.net> <2461b452-f595-6fa9-4e33-9e163f79d162@fleshgrinder.com> <57322FFC.1040109@lsces.co.uk> To: Lester Caine , internals@lists.php.net Message-ID: <8d5a0962-021b-cd38-1946-47d1bad24af0@fleshgrinder.com> Date: Tue, 10 May 2016 21:18:09 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <57322FFC.1040109@lsces.co.uk> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="mld8hmDjhaTlaEXpdAIJeOafBgl5FhMtU" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC] Allow loading extensions by name From: php@fleshgrinder.com (Fleshgrinder) --mld8hmDjhaTlaEXpdAIJeOafBgl5FhMtU Content-Type: multipart/mixed; boundary="vLEjUmea4xVavlecrLK1K2LFhjg8iXKvR" From: Fleshgrinder Reply-To: internals@lists.php.net To: Lester Caine , internals@lists.php.net Message-ID: <8d5a0962-021b-cd38-1946-47d1bad24af0@fleshgrinder.com> Subject: Re: [PHP-DEV] [RFC] Allow loading extensions by name References: <59e5902d-004f-33b5-5d6f-991d89371e05@php.net> <2461b452-f595-6fa9-4e33-9e163f79d162@fleshgrinder.com> <57322FFC.1040109@lsces.co.uk> In-Reply-To: <57322FFC.1040109@lsces.co.uk> --vLEjUmea4xVavlecrLK1K2LFhjg8iXKvR Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 5/10/2016 9:01 PM, Lester Caine wrote: > The idea has been proposed before, but the addition of php_ for windows= > installs has not been universally applied. Extensions like eAccelerator= , > adodb and other third party extensions that did not form part of the > windows 'installation' files. Most of these have been killed off by the= > restructuring of the core so it's probably less of a problem now than 5= > years ago! >=20 > Another negative is the fact that most Linux installations do not use > entries in the php.ini file to enable extensions, preferring to manage > them via the package manager. THAT particular practice is something I > already copy back to the windows installs, using individual .ini files > for each extension, and stripping those extensions and settings from th= e > main php.ini. >=20 > This is not simply a matter of adding another load mechanism to the mix= , > so any rfc should perhaps bear in mind all the aspects of 'package > management' process? Certainly it's not quite as simple as assuming > windows extensions start php_ and end .dll ... >=20 Handling of the prefix is a no brainer. Just check for php_NAME.dll and fallback to NAME.dll on Windows otherwise. If both fail error out. The approach to split ini files does not work on CLI. UNIX: `php -d extension=3Dfoo.so -d zend_extension=3Dbar.so` WIN: `php -d extension=3Dphp_foo.dll -d zend_extension=3Dphp_bar.dll` RFC: `php -d extension=3Dfoo -d zend_extension=3Dbar` Are there really extension on Windows without `.dll` extension? I highly doubt it and would consider erroring out to be okay. Users can still specify the exact path if the want to. function load_extension($name) { $extension_dir =3D ini_get('extension_dir'); $extension_dir =3D rtrim($extension_dir, DIRECTORY_SEPARATOR); $extension_dir .=3D DIRECTORY_SEPARATOR; if (DIRECTORY_SEPARATOR =3D=3D=3D '\\') { foreach (['php_', ''] as $prefix) { $path =3D $extension_dir . $prefix . $name . '.dll'; if (is_file($path)) { return do_load_extension($path); } } else { $path =3D $extension_dir . $name . '.so'; if (is_file($path)) { return do_load_extension($path); } } return do_load_extension($name); } Something along these lines should do it (of course in C). :) --=20 Richard "Fleshgrinder" Fussenegger --vLEjUmea4xVavlecrLK1K2LFhjg8iXKvR-- --mld8hmDjhaTlaEXpdAIJeOafBgl5FhMtU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXMjP3AAoJEOKkKcqFPVVr2QwP/1IEDytKxOA7tRRumkpS1+rM MQlQihs3wlC4x8kfC7P5gYCwaoL9mW5bOo8WBra4JXRoui4si12o6iycb4b/88ps a4LZFikD2uLUAfS8c91OWso3SeBCT7H3mo5RwMBr7JfER/fNtQaMixuaNKSuMNBN 4cv0nWzio7AuezgXMGNTUGl32z/9JHtjqZaTkDYVkZ8IfSNzKa7b7uDOX1Wkr8LT 4qBnzLExxmczMC3Ncqw/Ydf/kHsowG9lmq2+dc82lXRcl+BMHi2cYsZLBLYtZbp2 FIiuq2cYGmhsDRbJ30733hLLB/3KnSFwi005BKD6hb+vCme58mylGOcFcE27JOsH lFJTBfb4q/uKDiNKJ1+S2IBNOxUYiY3Tk8RtspTSqcK6ANd1oRHw+2wQXWXy8PD4 1TstNuvx72xqrwMCIhGUUsqA6A7ozZCtwaMF4RAbMDidaPZmHy5n5AQc2siFwkMU u/fIHrSDPchZN1S1BOMfoGiq8AoBCdVWloY/gGG7Gr87YlmpxXMNmEVY38Kweg2X ENk5Q0x13EUTYSbTQ+WHlr81/yM9sIYFD2zmMF3h1XQhULqkLjzLOeYDmgkAScM8 MjFRPouD3W43/JREJ4lG/DUjYOvxKmNIOqA9srNehYHp9hp+uWKVposhBupMITT/ fuR4FsQ3cKr0PBY85NBC =M8QD -----END PGP SIGNATURE----- --mld8hmDjhaTlaEXpdAIJeOafBgl5FhMtU--