# Feature(let) idea

- Thread: https://externals.io/message/30235
- Original archive: https://news-web.php.net/php.internals/30235
- Started by Andi Gutmans on 2007-06-19T01:21:33+00:00
- Messages: 11
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #30235 — Andi Gutmans — 2007-06-19T01:21:33+00:00

URL: https://externals.io/message/30235#30235

I got a feature idea from Apache. Apache will automatically translate
mod_rewrite.so in LoadModule to mod_rewrite.dll on Windows. It'd be nice
if we added the same to PHP so you wouldn't need to maintain two
php.ini's between UNIX & Windows machines. It's a pretty easy patch but
I wanted to run it by people here before working on a patch.

Andi

---

## #30236 — Stefan Priebsch — 2007-06-19T06:51:39+00:00

URL: https://externals.io/message/30235#30236 · In reply to: #30235

Andi,

Andi Gutmans schrieb:
> I got a feature idea from Apache. Apache will automatically translate
> mod_rewrite.so in LoadModule to mod_rewrite.dll on Windows. It'd be nice
> if we added the same to PHP so you wouldn't need to maintain two
> php.ini's between UNIX & Windows machines. It's a pretty easy patch but
> I wanted to run it by people here before working on a patch.
> 
> Andi

I like this idea, but the directory layout is usually rather different
between Windows and Unix, so there will probably still be differences in
the php.ini regarding to include_path and extension_dir.

Kind regards,

Stefan


-- 
 >e-novative> - We make IT work for you.

 e-novative GmbH - HR: Amtsgericht München HRB 139407
 Sitz: Wolfratshausen - GF: Dipl. Inform. Stefan Priebsch

 http://www.e-novative.de

---

## #30238 — dz@bitxtender.com — 2007-06-19T08:07:17+00:00

URL: https://externals.io/message/30235#30238 · In reply to: #30236

Yeah, not to mention things like temp dirs, sendmail/smtp settings  
etc...


David



Am 19.06.2007 um 08:51 schrieb Stefan Priebsch:
> Andi,
>
> Andi Gutmans schrieb:
> > […]
>
> I like this idea, but the directory layout is usually rather different
> between Windows and Unix, so there will probably still be  
> differences in
> the php.ini regarding to include_path and extension_dir.
>
> Kind regards,
>
> Stefan
>
>
> -- 
> > […]
>
>  e-novative GmbH - HR: Amtsgericht München HRB 139407
>  Sitz: Wolfratshausen - GF: Dipl. Inform. Stefan Priebsch
>
>  http://www.e-novative.de

---

## #30240 — Pierre — 2007-06-19T08:17:58+00:00

URL: https://externals.io/message/30235#30240 · In reply to: #30236

> Andi,
>
> Andi Gutmans schrieb:
> > […]
>
> I like this idea, but the directory layout is usually rather different
> between Windows and Unix, so there will probably still be differences in
> the php.ini regarding to include_path and extension_dir.

The idea is to use the same set of "extension=foo" directives for all
platforms (nearly all). It is relatively obvious that extension_dir
will differ.

I like this idea and will ease our life, a litte :)

Cheers,
--Pierre

---

## #30241 — Stefan Priebsch — 2007-06-19T08:36:09+00:00

URL: https://externals.io/message/30235#30241 · In reply to: #30240

Pierre,

> The idea is to use the same set of "extension=foo" directives for all
> platforms (nearly all). It is relatively obvious that extension_dir
> will differ.
> 
> I like this idea and will ease our life, a litte :)

I got that, and I like simplification. It would just not really make
php.ini files "portable" between Windows and Unix.

I could even think of some other feature(let)s that might help us move
into that direction:

- define a unified path separator for include_path (the system-dependend
ones could still be accepted, thus keeping BC)
- accept paths in php.ini with forward slashes on all systems (I think
Apache also does -even requires- it that way)
- for system-dependent settings like SMTP, have SMTP.Windows and
SMTP.Unix settings that can "override" the general SMTP setting (this
idea certainly needs some more thought)
- also make zend_extension and zend_extension_ts "guess" wether dll or
so is to be loaded

Kind regards,

Stefan

-- 
 >e-novative> - We make IT work for you.

 e-novative GmbH - HR: Amtsgericht München HRB 139407
 Sitz: Wolfratshausen - GF: Dipl. Inform. Stefan Priebsch

 http://www.e-novative.de

---

## #30245 — Pierre — 2007-06-19T08:45:49+00:00

URL: https://externals.io/message/30235#30245 · In reply to: #30241

> Pierre,
>
> > […]
>
> I got that, and I like simplification. It would just not really make
> php.ini files "portable" between Windows and Unix.

It will make extension mgr life easier, not more, not less, and that's
already a lot :)

> I could even think of some other feature(let)s that might help us move
> into that direction:
>
> - define a unified path separator for include_path (the system-dependend
> ones could still be accepted, thus keeping BC)
> - accept paths in php.ini with forward slashes on all systems (I think
> Apache also does -even requires- it that way)

We support / on windows already. If someone uses \ only, he puts
himself in the non ""portable"" side. I don't really see a reason to
stop to support one or another.

> - also make zend_extension and zend_extension_ts "guess" wether dll or
> so is to be loaded

just like the extension directive yes.

That being said, a 100% portable php.ini is not possible, the main
problem I had so far was to deal with different extension names on the
various platforms. However, it was less than a problem after that `dl()`
has been deprecated. But it can make installer/tester life easier to
have one common way to define extension in php.ini, even if the
various paths differ (to stay on topic).

Grüß
--Pierre

---

## #30246 — francois.laupretre@ratp.fr — 2007-06-19T08:58:24+00:00

URL: https://externals.io/message/30235#30246 · In reply to: #30241

> The idea is to use the same set of "extension=foo" directives for all
> platforms (nearly all). It is relatively obvious that extension_dir
> will differ.

IMHO, it should also allow to `dl()` by extension name, but only as a fallback mechanism to keep BC. 
First consider the argument as a filename, then, if it cannot be loaded, try to add the prefix/suffix
corresponding to the current architecture. Performance aspects shouldn't matter for `dl()`.

Here is an example of the logic to implement, taken from the PHK code (I think it is the same in PEAR
now, with the HP-UX case added recently) :

public static function require_extension($ext)
{
if (extension_loaded($ext)) return;

if (ini_get('enable_dl') != 1)
	trigger_error($ext.': Cannot load extension when enable_dl is Off'
		,E_USER_ERROR);
if (ini_get('safe_mode') == 1)
	trigger_error($ext.': Cannot load extension in safe mode',E_USER_ERROR);

if (substr(PHP_OS, 0, 3) == 'WIN') $suffix = '.dll';
elseif (PHP_OS == 'HP-UX') $suffix = '.sl';
elseif (PHP_OS == 'AIX') $suffix = '.a';
elseif (PHP_OS == 'OSX') $suffix = '.bundle';
else $suffix = '.so';

@dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
if (!extension_loaded($ext)) throw new Exception("$ext: Cannot load extension");
}

---

## #30297 — William A. Rowe — 2007-06-21T05:52:46+00:00

URL: https://externals.io/message/30235#30297 · In reply to: #30235

Andi Gutmans wrote:
> I got a feature idea from Apache. Apache will automatically translate
> mod_rewrite.so in LoadModule to mod_rewrite.dll on Windows.

It does?  Apache/Win32 actually names the '.dll' as mod_rewrite.so on
windows.  There's nothing special about the '.dll' filename extension,
a similar example is the .cpl control panel extensions, which are .dll's
that are loaded into the system settings schema, .scr for screensaver
dll's following that API, etc.

In general, it's a good idea.  My builds of php on win32 *are* entirely
in the unix-style, for my customers who need to toggle between win32 and
unix.  It makes the documentation much simpler when you don't need two
entirely different sets.

Bill

---

## #30299 — Andi Gutmans — 2007-06-21T06:08:36+00:00

URL: https://externals.io/message/30235#30299 · In reply to: #30297

Damn, I think you are right :)
That's weird. There are some tools which only work with the .dll
filename (i.e. Windows Explorer).

Maybe my idea is better then :)
Andi 

> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net] 
> Sent: Wednesday, June 20, 2007 10:53 PM
> To: Andi Gutmans
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Feature(let) idea
> 
> Andi Gutmans wrote:
> > […]
> translate 
> > […]
> 
> It does?  Apache/Win32 actually names the '.dll' as 
> mod_rewrite.so on windows.  There's nothing special about the 
> '.dll' filename extension, a similar example is the .cpl 
> control panel extensions, which are .dll's that are loaded 
> into the system settings schema, .scr for screensaver dll's 
> following that API, etc.
> 
> In general, it's a good idea.  My builds of php on win32 
> *are* entirely in the unix-style, for my customers who need 
> to toggle between win32 and unix.  It makes the documentation 
> much simpler when you don't need two entirely different sets.
> 
> Bill

---

## #30302 — William A. Rowe — 2007-06-21T06:47:32+00:00

URL: https://externals.io/message/30235#30302 · In reply to: #30299

Windows Explorer on WinXP does a fine job for me displaying binary
version numbers, pulling up dll properties of .so files, etc.

Not sure which issue you are seeing?



Andi Gutmans wrote:
> Damn, I think you are right :)
> That's weird. There are some tools which only work with the .dll
> filename (i.e. Windows Explorer).
> 
> Maybe my idea is better then :)
> Andi 
> 
> > […]

---

## #30308 — Richard Quadling — 2007-06-21T07:26:48+00:00

URL: https://externals.io/message/30235#30308 · In reply to: #30302

> Windows Explorer on WinXP does a fine job for me displaying binary
> version numbers, pulling up dll properties of .so files, etc.
>
> Not sure which issue you are seeing?
>
>
>
> Andi Gutmans wrote:
> > […]

In the main, I think it would be very odd for Windows users to see .so
files in place of .dlls.

For those not aware, in windows the extension is linked to a handler
(Run, Open, Edit, Print, etc) via the registry.

A .dll file is known to be an "Application Extension" and has no
default Run/Open handler, though you can install something like a
resource explorer to examine the dll as they often contain menus,
bitmaps, icons, dialogs, etc (resources).

So, making the files .so for compatibility to other OS's, as far as
windows goes, is fine.

But, confusing for many probably.

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
