Page 1 of 1

enhancement proposal for 'portable' variant

PostPosted: 03. July 2017 18:51
by dr1fter
I recently required a development environment for WordPress-development, so I found xampp. I chose the portable variant.

After extracting it, I had a closer look at what the 'apache_start.bat' file does (after reading the enclosed readme file).

I did not like the prospect of having to place the package into the root directory, so I found out a more elegant way of getting the application server to start without having assume a certain file system location: by simply defining an environment
variable in the apache startup script, containing the current xampp installation directory and consuming this variable in all relevant configuration files:

----------------------
apache_start.bat:

' add (at the beginning):
SET XAMPP_ROOT=%~dp0

apache/conf/httpd.conf
apache/conf/extra/httpd-xampp.conf
apache/conf/extra/httpd-ssl.conf
php/php.ini

# replace each absolute path ('/xampp' or '\\xampp') with ${XAMPP_ROOT}
----------------------

There is probably a couple of additional locations I omitted - after changing the above-mentioned files I could successfully start-up apache and run PHP applications in it.

The benefit I see in this approach is that the application may be arbitrarily moved around in the file system without any manual configuration required afterwards. Also, arbitrary directories may be used.

How about adding this change into the product?

--

I tried the same for the mysql server. Unfortunately, mysqld does not seem to support evaluating environment variables. However, I think it should be possible to either pass all relevant configuration parameters via CLI - or it would also be thinkable to generate a configuration file on-the-fly

Cheers,
Christianh

Re: enhancement proposal for 'portable' variant

PostPosted: 03. July 2017 20:02
by Altrea
Hi Christianh,

Thanks for the suggestion. Xampp portable uses a different approach.
After moving xampp around simply execute the setup-xampp.bat script once. This script will set all paths of all single components to the new path, of cause portable again (without any drive letter).

Best wishes,
Altrea

Re: enhancement proposal for 'portable' variant

PostPosted: 04. July 2017 08:04
by dr1fter
Hi Altrea,

I have to admit that I only read the first part of the sentence in the (german) readme (the remainder explaning that top-level directory installation is required only for "USB sticks", I did not notice :oops: ).

That being said, I suggest that the env-var based approach would have the benefit that you could get rid of the setup-xampp.bat script. And not need to discriminate between "USB stick" installations and other installations (which I would consider to be more convenient for users).

There is of course also a benefit in generating static configuration. So my other suggestion would be to _always_ generate configuration files prior to starting (as part of the regular *_start.bat files), rather than having users explicitly do that.

Would you also consider adding bash scripts along with the windows batch files? This would be beneficial for users working with MinGW on NT (I am using such a setup, obviously ;-))