summaryrefslogtreecommitdiff
path: root/issues/genenetwork1/gn1-annotation-page-is-broken.gmi
blob: a03b19546879615bb18732df35daa3b39777dd17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# GN1 annotation page broken


## Tags

* assigned: zsloan, pjotrp
* priority: high
* status: testing
* type: bug
* keywords: GN1, genenetwork1, annotation, from github

## Tasks

* [ ] Fix PHP view
* [ ] Fix CKEDITOR

## Description

Turns out that it is a PHP page that is not working. Also CKEDITOR is not visible.

=> https://github.com/genenetwork/genenetwork2/issues/421 From GitHub

=> http://gn1.genenetwork.org/webqtl/main.py?FormID=annotation The annotations page in GN1
is broken. An exception stack trace is displayed, instead of the annotations page content.

## Info

Lily runs a PHP from 2006(!)

PHP 5.1.6 (cli) (built: Mar 18 2014 20:48:55)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

In guix-bioinformatics we have

```
php     5.6.40  out     /home/gn1/guix-bioinformatics/gn/packages/php.scm:14:2
```

Even if this page is for windows, it is the best description of using PHP:

=> https://www.thesitewizard.com/php/install-php-5-apache-windows.shtml

On lily:

```
AddType application/x-httpd-php .htm .html
```

And Apache:

```
[root@lily conf]# /usr/sbin/httpd -V
Server version: Apache/2.2.3
Server built:   Sep 16 2014 11:05:09
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
```

This is similar what we have in Guix GN1. No mention of PHP in either.

For simplicity we may switch to php-cgi

=> https://stackoverflow.com/questions/28823252/installing-php-5-3-29-from-sources-on-ubuntu-14-with-apache-2-module

=> https://www.bobulous.org.uk/coding/apache-php-cgi.html

## Test instance of GN1

I started a test instance that listens on port 8044 and is hosted in this dir and started with:

```
gn1@tux01:~/production/gnshare/gn-pjotr-test
. .guix-deploy
gn1@tux01 ~/production/gnshare/gn-pjotr-test [env]$ httpd -f `pwd`/etc/pjotr-test-httpd.conf
```

Restart with

```
pkill httpd ; sleep 1 ; httpd -f `pwd`/etc/pjotr-test-httpd.conf
```

Created a file in web/test/index.html and it displays as

=> http://gn1-pjotr.genenetwork.org/test/index.html

Now a php version

=> http://gn1-pjotr.genenetwork.org/test/index.php

works after setting

```
# CUSTOM: Add PHP 5 parsing (via CGI) handler and action
ScriptAlias /local-bin /gnu/store/213zqkj0r6q41cqarwkz5x568ybhd62b-profile/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi
<Directory "/usr/local/bin">
    Order allow,deny
    Allow from all
</Directory>

<Directory /home/gn1/production/gnshare/gn-pjotr-test/web/test>
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
```

## Finding PHP files

All files that have ?php are in ./infoshare. Try

```
gn1@tux01:~/production/gnshare/gn-pjotr-test$ grep '?php' -r > phpfiles.txt
```

they end in .htm and .html so we need to wire that together.

So adding a test in

=> http://gn1-pjotr.genenetwork.org/infoshare/manager/test/index.html

and updating Addhandler to parse .htm and .html works.

```
AddHandler application/x-httpd-php5 php htm html
```

## MySQL connector

We need to tell GN1 to use a more recent mysql connector and drive it over sockets, rather than the web interface. This requires telling it where the INI file is.

This required adding a path for Apache:

```
SetEnv PHP_INI_SCAN_DIR /home/gn1/production/gnshare/gn-pjotr-test
```

and a php.ini file with

```
[Pdo_mysql]
pdo_mysql.default_socket= /run/mysqld/mysqld.sock

[MySQLi]
mysqli.default_socket = /run/mysqld/mysqld.sock
```

Now it remains to replace the mysql connectors with mysqli - a newer driver for PHP. For this we use a translation script from

=> https://github.com/rubo77/php-mysql-fix/blob/master/fix_mysql.inc.php

that gets included with

```
include_once('../includes/fix_mysql.inc.php')
```

At the final step we have to fix CKEDITOR

## CKEDITOR

FF console says:

```
Uncaught ReferenceError: CKEDITOR is not defined
    <anonymous> Ember
```

Turns out that lily URLs were hard-coded in the source. So, that was an easy fix. There are still some complaints about CSS links missing in the browser console, but until someone sees a difference I does not need fixing.

Changing the status to testing now.

## Updating production

The source code is now in sync on 'master' branch. Now I need to update guix-bioinformatics package to set up the container correctly with Apache httpd.conf.