>>> The problem (and the thing which put me off tackling this on the >>> current >>> windows installer) is that there are so many ways that a use could >>> have
>>> already set up their httpd.conf (with regard to global and vhost
>>> configurations, whether httpd.conf does all the config, or there are
>>> include
>>> files and .htaccess files doing things), the installer would need to
>>> more or
>>> less fully understand apache configuration rules to be able to (a) >>> make
>>> sure
>>> that php was working at the end of the install, and (b) nothing else >>> was >>> broken. It would also probably need a massive user interface in order >>> to
>>> deal
>>> with the many decisions which would need to be made in order to work >>> out
>>> precisely what to do.

I do agree with Phil here; the last thing we would want is to leave
extra junk in the user's http.conf, nor we want to "break things"
because they have different things enabled, thus resulting in a
non-working install.

Well, given that 3 of them really can't break anything...

<IfModule mod_dir.c>
   DirectoryIndex index.html index.htm index.php
</IfModule>

This one's global by its nature. It tells you which file extensions are accepted as potential directory index pages by the server. As I wrote before, the best way to do it would be to check whether the existing DirectoryIndex directive already contains index.php and add it (whitespace-separated) if not. If a filename is added there twice it works anyway, it's just that it'll look messy after the second install - and, particularly when you have updating facilities, there's likely to be a second install.

I looked at wix API last night but only found the comma-separated thingie for adding to existing lines...

Next up,

<IfModule mod_mime.c>
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps
</IfModule>

These are also global by their nature. mod_mime simply defines a mime type, so you could add those two directly to conf/mime.types if it's easier to check for them there (one-per-line in alphabetical order, they can go just above the x-javascript entry, but alphabetical order's just prettification - not important).

The syntax is a little different in mime.types:

application/x-httpd-php   php
application/x-httpd-php-source phps

with tabs rather than spaces and no leading dot on the ext. Again, although adding twice doesn't actually do any damage - and you can have multiple extensions per mime type - it would be sensible to check for the presence of those exact lines in the file before writing them there, purely because repeat installs will make the file look messy otherwise.

None of the above are 'additional junk'; these are things that could easily be in the distributed Apache configuration files if PHP wasn't a third-party Apache module, in fact I don't know why the mime ones aren't there anyway.

Personally, I like the approach many Linux distros ( Ubuntu is one
that I've seen do this ) is instead of one monolithic httpd.conf file,
they have it include the configuration for the various modules
seperately so that they can add and remove the config code cleanly.
That I could see working well; you'd still have the risk of a
non-working install, but making it work again is simply commenting out
one line.

Steph, do you think this approach would work?

I had a new discovery this morning: mod_alias is built-in statically in Apache win32 distributions, i.e. we don't actually need to check for it. If the above suggestions are possible, that leaves a maximum of two lines to add at the bottom of httpd.conf:

EITHER

ScriptAlias /php/ "/PROGRA~1/PHP/"
Action application/x-httpd-php "/php/php-cgi.exe"

OR

PHPIniDir "/PROGRA~1/PHP/"     /* this applies to Apache 2.* module only */
LoadModule php5_module "/PROGRA~1/PHP/php5apache.dll"

The php.ini file, on completion, needs to be copied to one with the relevant SAPI name. In the case of Apache 1 only, php-apache.ini needs to be in the toplevel Apache directory. In every other case (php-cli.ini, php-cgi-fcgi.ini php-apache2.ini, and php-whatever-2.2-SAPI-is-called.ini) it needs to be in the PHP install dir. That means the only chance of having a meaningful collision with an existing PHP installation is via the Apache 1 module, thanks to the placement of that .ini file.

Either pair of lines could potentially break an existing PHP setup, sure. But given that the mime type declaration and DirectoryIndex list can't break anything, effectively you're advocating one line and an extra file instead of two lines here - and all four lines at least begin with the same thing every time no matter how you may have installed them previously:

ScriptAlias /php/
Action application/x-httpd-php

PHPIniDir
LoadModule php5_module

So, would it be possible to check httpd.conf for those lines and notify in the case of a conflicting install request?

'Uninstall' would just mean deleting those two lines, not the mime type support or the directory index entry.

I do think it should be made clear that this is a global install on the Apache server and that anything more complex (vhosts or whatever) needs to be done manually. I didn't see any obvious way to open a file for editing from within a wix installer though - is that possible or not?

- Steph


--
Later,

John Mertic
"Explaining a joke is like dissecting a frog: you
[EMAIL PROTECTED]                                       understand it
better, but the frog dies in the

process."

                                            -Mark Twain

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to