Apache + PHP Installer

Started by AyrA, August 01, 2020, 09:43:06 PM

Previous topic - Next topic

AyrA

As part of my job I have to install and uninstall Apache quite frequently for our apprentices, sometimes with PHP, sometimes without.

Because of this, I made an installer. I don't mean a collection of scripts, but a real installer like you would use for any other software.
https://imgur.com/a/QjeJtRG

I originally didn't intend for it to be used publicly but I changed a few things to make it suitable. Notable features:


  • Created a page for update checks and download of installer bundles. There's currently only one installer but I intend for it to grow over time
  • Made installer more foolproof (It should stop the service when you try to update a running instance for example)
  • Added ability to create firewall rules
  • It will create the configuration files and php.ini if not present but will never overwrite them
  • php.ini is dynamically changed to reflect a custom path selection by the user
  • Post install notes that provide some troubleshooting hints and explain the problems that can arise from running Apache as "Local Service"
  • Digital signature. Note: Only the installer and uninstaller are currently signed. I can sign all Apache+PHP binaries in the installer upon popular request but it should not be necessary
  • Made PHP optional
  • Added the license and changes file
  • Permission hardening can be reversed and reapplied at any time
  • Removes firewall rules again when you uninstall
  • The contents of "htdocs" are never deleted when uninstalling in case you need them later
  • Apache is run under an unprivileged "Local Service" user instead of a god account
  • It should work if there are spaces in the path name (I still recommend you don't)

I can include all the optional modules if requested. I do not plan on creating 32 bit installers.

The default server configuration has been slightly changed:


  • Apache is configured to use PHP as a CGI module using the ScriptAlias/ContentType model. This is always present, even if you don't install PHP, but in that case it has no effect
  • index.php added to the automatic directory index
  • inclusion of conf/extra/httpd-mpm.conf is enabled by default

The PHP configuration is as follows:


  • The base is the development PHP ini file
  • Custom "temp" and "session" paths so PHP doesn't pollutes the Windows temp directory
  • Safer session handling (user can't create their own id, the id is not accessible from JS)
  • Configured a CA file that's in sync with Windows (at the time of creating the setup)

If interested, you can obtain the setup here: https://cable.ayra.ch/apache/

Feedback is encouraged. Thank you.

mario

That is a great tool. You only should avoid using the feather icon from ASF.

AyrA

I usually default the icon to the main executable. Is there a specific reason that using the main executable icon is not a good idea?

The alternative I have at hand would be the default installer Icon that you see with pretty much every installer.

Steffen

As Mario said you should avoid.

Yes, be careful, the installer is not an Apache product, and that is not allowed by the Policy from the ASF.

The feather graphics are trademarks of the ASF, and must not be used without appropriate attribution and permission from the ASF. Please see our formal Trademark Policy for more details. In particular, as a vendor-neutral public charity that provides independent governance to all Apache projects, you must use care when displaying the feather, and ensure it's clear that it's referring to the ASF as an independent organization.

https://apache.org/foundation/press/kit/
http://www.apache.org/foundation/marks/

sympl

I'll try this. Sounds pretty cool

AyrA


mario


Swirek

#7
Wow! Nice info about PHP 8! Thanks!

mario

I tried the new installer with PHP and noticed that Define SRVROOT "/Apache" was commented out and apache won't start. Not an issue for me, but it might be worth to change that,

AyrA

It's commented out because the "SRVROOT" constant is supplied as command line argument to the service. Inno Setup (the engine I'm using for the installer) lacks a way to dynamically edit files without writing custom file I/O code. The only thing you can do it set values in INI files, which works fine for the PHP configuration but not for the apache config.

I will eventually change that so the setup calls a hidden batch file to set dynamic values in a separate file that's included inside of the main config. I would then be able to overwrite this file each time a new version is installed without having to go through the hassle of editing a file.

Rodan

#10
My apache won start too. I will try to figure it out.

AyrA

This is weird. I test the installers on a blank Windows 7 VM every time and you're the second person now that complains that it won't work.

Does the path in the service command line match the path of your apache? You can get to the command by running "services.msc" and double clicking on "Apache"


mario

 AyrA that was a spam post with a hidden url included. Your installer works fine.