Bug 13486 - About page Apache version is empty if Apache version is 2.4
Summary: About page Apache version is empty if Apache version is 2.4
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: About (show other bugs)
Version: 3.18
Hardware: PC Linux
: P5 - low minor (vote)
Assignee: Jerry Weng
QA Contact: Testopia
URL:
Keywords:
: 14278 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-12-22 02:23 UTC by Jerry Weng
Modified: 2016-12-05 21:22 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
about.pl patch for getting version info on the apache 2.4/2.2 (522 bytes, patch)
2014-12-22 03:33 UTC, Jerry Weng
Details | Diff | Splinter Review
Bug 13486: Apache version empty in about page if Apache 2.4 (1.64 KB, patch)
2015-02-05 17:38 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 13486: Apache version empty in about page if Apache 2.4 (1.63 KB, patch)
2015-05-12 15:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 13486: Apache version empty in about page if Apache 2.4 (1.75 KB, patch)
2015-05-12 15:51 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 13486: Apache version empty in about page if Apache 2.4 (1.82 KB, patch)
2015-05-22 09:22 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jerry Weng 2014-12-22 02:23:47 UTC
Overview: 

Ubuntu 14.04.1, Apache version 2.4.7-1ubuntu4.1, Koha 3.18.01
About Koha Page -> Server information -> Apache version is empty

Errors in directly running /usr/sbin/apache2 -V and similar entries in /var/log/koha/library/intranet-error.log 
[Mon Dec 22 10:18:42.479349 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Dec 22 10:18:42.480141 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Dec 22 10:18:42.480616 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Dec 22 10:18:42.481116 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Dec 22 10:18:42.728000 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
[Mon Dec 22 10:18:42.776297 2014] [core:warn] [pid 2225] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}
Comment 1 Jerry Weng 2014-12-22 02:30:00 UTC
(In reply to Jerry Weng from comment #0)
> Overview: 
> 
> Ubuntu 14.04.1, Apache version 2.4.7-1ubuntu4.1, Koha 3.18.01
> About Koha Page -> Server information -> Apache version is empty
> 
> Errors in directly running /usr/sbin/apache2 -V and similar entries in
> /var/log/koha/library/intranet-error.log 
> [Mon Dec 22 10:18:42.479349 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_PID_FILE} is not defined
> [Mon Dec 22 10:18:42.480141 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_RUN_USER} is not defined
> [Mon Dec 22 10:18:42.480616 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_RUN_GROUP} is not defined
> [Mon Dec 22 10:18:42.481116 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_LOG_DIR} is not defined
> [Mon Dec 22 10:18:42.728000 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_RUN_DIR} is not defined
> [Mon Dec 22 10:18:42.776297 2014] [core:warn] [pid 2225] AH00111: Config
> variable ${APACHE_LOG_DIR} is not defined
> AH00543: apache2: bad user name ${APACHE_RUN_USER}

Worked after fixing the following line, also tested on Apache/2.2.22 (Ubuntu), seems backward compatible.

/usr/share/koha/intranet/cgi-bin/about.pl

 my $mysqlVersion  = `mysql -V`;
 my $apacheVersion = `httpd -v 2> /dev/null`;
 $apacheVersion = `httpd2 -v 2> /dev/null` unless $apacheVersion;
+$apacheVersion = (`/usr/sbin/apache2ctl -V 2> /dev/null`)[0] unless $apacheVersion;
-$apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
 my $zebraVersion = `zebraidx -V`;
Comment 2 Jerry Weng 2014-12-22 03:33:56 UTC Comment hidden (obsolete)
Comment 3 Paul A. 2015-02-05 16:16:38 UTC
The following is perhaps simpler and is backwards compatible (I wrote it for 3.18, tested it on our production 3.08):

me@hood:/usr/share/koha/intranet/cgi-bin$ diff about.pl about.pl_orig
61d60
< $apacheVersion = (`/usr/sbin/apachectl -v`) unless $apacheVersion;
Comment 4 Tomás Cohen Arazi 2015-02-05 17:27:14 UTC
This bug exists in current master.
Comment 5 Tomás Cohen Arazi 2015-02-05 17:38:04 UTC Comment hidden (obsolete)
Comment 6 Paul A. 2015-02-05 19:18:44 UTC
(In reply to Tomás Cohen Arazi from comment #5)
[snip]
> If you have an Apache 2.2 setup to try it, verify that there are no
> regressions
> (trivial because you can run apache2ctl manually and verify the first result
> is the expecte).
> 
> Regards
> 
> PS. I even changed the order in which Apache version is tested because
> most people is using Debian/Ubuntu and it was the last option.

I suggest leaving it as last line. Apache2 responds with:

me@production:/$ apache2ctl -v
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Feb 13 2012 01:51:56

unless you edit /etc/security/limits.conf to include a hard and soft file limit of 8192 instead of the debian/ubuntu default 1024 ($ ulimit -n). I don't think Koha should oblige users to change "security" settings.
Comment 7 Paul A. 2015-02-05 19:19:12 UTC
(In reply to Tomás Cohen Arazi from comment #5)
[snip]
> If you have an Apache 2.2 setup to try it, verify that there are no
> regressions
> (trivial because you can run apache2ctl manually and verify the first result
> is the expecte).
> 
> Regards
> 
> PS. I even changed the order in which Apache version is tested because
> most people is using Debian/Ubuntu and it was the last option.

I suggest leaving it as last line. Apache2 responds with:

me@production:/$ apache2ctl -v
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Feb 13 2012 01:51:56

unless you edit /etc/security/limits.conf to include a hard and soft file limit of 8192 instead of the debian/ubuntu default 1024 ($ ulimit -n). I don't think Koha should oblige users to change "security" settings.
Comment 8 Paul A. 2015-02-05 19:19:36 UTC
(In reply to Tomás Cohen Arazi from comment #5)
[snip]
> If you have an Apache 2.2 setup to try it, verify that there are no
> regressions
> (trivial because you can run apache2ctl manually and verify the first result
> is the expecte).
> 
> Regards
> 
> PS. I even changed the order in which Apache version is tested because
> most people is using Debian/Ubuntu and it was the last option.

I suggest leaving it as last line. Apache2 responds with:

me@production:/$ apache2ctl -v
/usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not permitted)
Server version: Apache/2.2.22 (Ubuntu)
Server built:   Feb 13 2012 01:51:56

unless you edit /etc/security/limits.conf to include a hard and soft file limit of 8192 instead of the debian/ubuntu default 1024 ($ ulimit -n). I don't think Koha should oblige users to change "security" settings.
Comment 9 Tomás Cohen Arazi 2015-02-05 19:36:48 UTC
(In reply to Paul A. from comment #8)
> (In reply to Tomás Cohen Arazi from comment #5)
> [snip]
> > If you have an Apache 2.2 setup to try it, verify that there are no
> > regressions
> > (trivial because you can run apache2ctl manually and verify the first result
> > is the expecte).
> > 
> > Regards
> > 
> > PS. I even changed the order in which Apache version is tested because
> > most people is using Debian/Ubuntu and it was the last option.
> 
> I suggest leaving it as last line. Apache2 responds with:
> 
> me@production:/$ apache2ctl -v
> /usr/sbin/apache2ctl: 87: ulimit: error setting limit (Operation not
> permitted)
> Server version: Apache/2.2.22 (Ubuntu)
> Server built:   Feb 13 2012 01:51:56
> 
> unless you edit /etc/security/limits.conf to include a hard and soft file
> limit of 8192 instead of the debian/ubuntu default 1024 ($ ulimit -n). I
> don't think Koha should oblige users to change "security" settings.

Be it the first or the last line won't change the result. httpd and httpd2 would fail to run on debían anyway. Those warnings are painless btw. Please test the bugfix and sign if it works for you, in the about page.
Comment 10 Paul A. 2015-02-05 20:37:40 UTC
It does in fact make a difference (3.08, Apache 2.22). As last line, it is compatible with all other "About" entries. If not last line (i.e. inserted at line 60) it adds the "Build date."

I can definitely sign-off adding:

$apacheVersion = (`/usr/sbin/apachectl -v`) unless $apacheVersion;

as line 61.
Comment 11 Jerry Weng 2015-02-06 18:56:33 UTC
Indeed, using "-v (lower case)" instead of "-V (upper case)" to get the Apache version information is better and should be faster. 

But I would keep the [0] part to extract only the needed Apache version info., especially the 'uname -a' is already there, and the "Server built:" time is meaningless in apt-get installed package.  

> $apacheVersion = (`/usr/sbin/apache2ctl -v`)[0] unless $apacheVersion;

Regards,
Comment 12 Tomás Cohen Arazi 2015-05-12 15:18:10 UTC Comment hidden (obsolete)
Comment 13 Bernardo Gonzalez Kriegel 2015-05-12 15:51:56 UTC Comment hidden (obsolete)
Comment 14 Jonathan Druart 2015-05-22 09:22:46 UTC
Created attachment 39385 [details] [review]
Bug 13486: Apache version empty in about page if Apache 2.4

This patch makes about.pl query the running Apache version using
the apache2ctl command. I tested it on Apache 2.2 and is backwards
compatible (it is present in both).

To test:
( On an Apache 2.4 setup )
- Go to the about page
=> FAIL: "Apache version:" is empty
- Apply the patch
- Reload the page
=> SUCCESS: "Apache version:" shows the correct version.
- Sign off :-D

If you have an Apache 2.2 setup to try it, verify that there are no regressions
(trivial because you can run apache2ctl manually and verify the first result is the expecte).

Regards

PS. I even changed the order in which Apache version is tested because
most people is using Debian/Ubuntu and it was the last option.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Tested with apache 2.2/2.4, no errors

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Only tested with 2.4
Comment 15 Tomás Cohen Arazi 2015-05-22 14:18:19 UTC
Patch pushed to master.

Thanks Mark!
Comment 16 Tomás Cohen Arazi 2015-05-26 17:26:08 UTC
*** Bug 14278 has been marked as a duplicate of this bug. ***