enhancement proposal for 'portable' variant

Problems with the Windows version of XAMPP, questions, comments, and anything related.

enhancement proposal for 'portable' variant

Postby dr1fter » 03. July 2017 18:51

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
dr1fter
 
Posts: 2
Joined: 03. July 2017 18:36
XAMPP version: 7.1.6
Operating System: NT10 x64

Re: enhancement proposal for 'portable' variant

Postby Altrea » 03. July 2017 20:02

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8969
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: enhancement proposal for 'portable' variant

Postby dr1fter » 04. July 2017 08:04

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 ;-))
dr1fter
 
Posts: 2
Joined: 03. July 2017 18:36
XAMPP version: 7.1.6
Operating System: NT10 x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 56 guests