#1 Le 09/03/2015, à 17:44
- Jtomoise
Problème de script bash avec WIMS
Bonjour
Nous sommes plusieurs à rencontrer le même problème sur un script apache-config à exécuter lors de l'installation d'une plate-forme WIMS locale. Faute de réponse probante à nous fournir,sur WIMSEDU, il nous est conseillé de nous tourner vers la communauté Ubuntu...
Le scénario est donc le suivant :
ETAPE1
Après avoir exécuté successivement :
wims@Family:/var/www/wims/bin$ source /etc/apache2/envvars
wims@Family:/var/www/wims/bin$ /usr/sbin/apache2-V
bash: /usr/sbin/apache2-V: No such file or directory
wims@Family:/var/www/wims/bin$ /usr/sbin/apache2 -V
Server version: Apache/2.4.7 (Ubuntu)
Server built: Jul 22 2014 14:36:38
Server's Module Magic Number: 20120211:27
Server loaded: APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-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=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
Suivi du test :
wims@Family:/var/www/wims/bin$ echo $APACHE_LOCK_DIR
/var/lock/apache2
ETAPE 2
Le Script incriminé suivant
wims@Family:/var/www/wims/bin$ cat -n ./apache-config
1 #! /bin/sh
2 #
3 # This script adds WIMS-related definitions to Apache config.
4 # It must be run as root.
5 #
6 # If you want to prohibit the action of this script,
7 # insert the following word to httpd.conf (in a commented line):
8 # manually_configured_for_wims
9 #
10
11 if [ ! "$(id -ru )" = 0 ]; then
12 echo
13 echo This script adds WIMS-related definitions to Apache config.
14 echo It must be run as root.
15 echo
16 echo su to root before running this script!
17 echo
18 echo
19 exit
20 fi
21
22 distro=default
23 [ -f /etc/debian_version ] && distro=debian
24
25 PATH=$PATH:/usr/sbin:/sbin
26 export PATH
27 # httpd or apache?
28 httpd -v >/dev/null && httpdname=httpd
29 if [ -z "$httpdname" ]; then apache -v >/dev/null && httpdname=apache; fi
30 if [ -z "$httpdname" ]; then apache2 -v >/dev/null && httpdname=apache2; fi
31 if [ -z "$httpdname" ]; then httpd2 -v >/dev/null && httpdname=httpd2; fi
32 if [ -z "$httpdname" ]; then
33 cat <<@
34
35 Apache is not found on your system.
36 WIMS requires a running web server Apache.
37 Please first install Apache (>=1.3).
38
39 @
40 exit
41 fi
42 conffile=`$httpdname -V | grep SERVER_CONFIG_FILE | awk -F'=' '{print $2}' | tr -d ' "'`
43 confdir=`dirname $conffile`
44 if [ -z "$confdir" ]; then
45 cat <<@
46
47 Unknown web server. Version too early?
48 Please first update your web server to Apache >=1.3.
49
50 @
51 exit
52 fi
53
54 case $distro in
55 debian) conffile=$confdir/conf.d/wims.conf
56
57 ;;
58 esac
59
60 cd `dirname $0`/..
61 wimshome=`pwd`
62
63 if [ ! -e public_html/wims.cgi ] || [ ! -e bin/apache-config ]; then
64 echo Error: wrong directory. File wims.cgi not found.
65 echo
66 exit
67 fi
68
69 httpdroot=`$httpdname -V | grep HTTPD_ROOT | awk -F'=' '{print $2}' \
70 | tr -d ' "'`
71 if [ ! -z "$httpdroot" ]; then cd $httpdroot; fi
72
73 tmpfile=/tmp/wims-apache.conf
74 vtest=`$httpdname -v | grep Apache`
75 if [ -z "$vtest" ]; then
76 echo
77 echo You are not running Apache web server!
78 echo
79 echo You must configure manually your web server, this script cannot be used.
80 echo
81 exit
82 fi
83
84 conftest=`grep -i manually_configured_for_wims $conffile`
85 if [ ! -z "$conftest" ]; then
86 echo Manually configured $conffile not modified.
87 exit
88 fi
89
90 # The next two definitions should NEVER be changed.
91 startl="WIMS definitions start. Do not alter this line"
92 endl="WIMS definitions end. Do not alter this line"
93
94 case $distro in
95 debian) rm -f $tmpfile
96 ;;
97 *) awk 'BEGIN {a=1};
98 /'"$startl"'/ {a=0};
99 a==1 {print};
100 /'"$endl"'/ {a=1};' $conffile >$tmpfile
101 ;;
102 esac
103
104 if [ "$1" = "uninstall" ]; then
105 case $distro in
106 debian) rm -f $conffile $tmpfile
107 ;;
108 *) mv $tmpfile $conffile
109 ;;
110 esac
111 killall -HUP $httpdname
112 exit
113 fi
114
115 cat >>$tmpfile <<@
116 ###### $startl! ######
117 #
118 # If you manually add things concerning WIMS into this configuration file,
119 # add them BEFORE the 'WIMS definition start' line.
120 # Otherwise the addition will be erased in next update.
121 #
122 AddHandler cgi-script .cgi
123 @
124
125 # $vtest looks like "Server version: Apache/X.Y.Z (Unix)"
126 # $vmajor will be XY
127
128 vmajor=`echo $vtest | grep 'pache' | perl -pe 's/.*pache\/([\d]+).([\d]+).*/$1$2/'`
129
130 # Apache version == 1.2
131 if [ "$vmajor" = "12" ]; then
132 cat >>$tmpfile <<@
133 ScriptAlias /wims/wims.cgi $wimshome/public_html/wims.cgi
134 ScriptAlias /wims/wims.html $wimshome/public_html/wims.cgi
135 ScriptAlias /wims/index.html $wimshome/public_html/wims.cgi
136 ScriptAlias /wims/wims.gif $wimshome/public_html/wims.cgi
137 ScriptAlias /wims/wims.png $wimshome/public_html/wims.cgi
138 ScriptAlias /wims/wims.jpeg $wimshome/public_html/wims.cgi
139 ScriptAlias /wims/wims.jpg $wimshome/public_html/wims.cgi
140 @
141 # newer versions of Apache
142 else
143 cat >>$tmpfile <<@
144 ScriptAliasMatch ^/~wims/wims\.(.*) $wimshome/public_html/wims.cgi
145 ScriptAliasMatch ^/wims/wims\.(.*) $wimshome/public_html/wims.cgi
146 ScriptAliasMatch ^/~wims/index\.(.*) $wimshome/public_html/wims.cgi
147 ScriptAliasMatch ^/wims/index\.(.*) $wimshome/public_html/wims.cgi
148 ScriptAliasMatch ^/~wims/.._(.*).html $wimshome/public_html/wims.cgi
149 ScriptAliasMatch ^/wims/.._(.*).html $wimshome/public_html/wims.cgi
150 ScriptAliasMatch ^/~wims/getfile/(.*) $wimshome/public_html/wims.cgi
151 ScriptAliasMatch ^/wims/getfile/(.*) $wimshome/public_html/wims.cgi
152 ScriptAlias /wims/....\.cgi $wimshome/public_html/wims.cgi
153 @
154 fi
155
156 # Apache version >= 2.4
157 if [ "$vmajor" -ge "24" ]; then
158 require_line="Require all granted"
159 # Older Apache versions
160 else
161 require_line="allow from all"
162 fi
163
164 cat >>$tmpfile <<@
165 Alias /wims $wimshome/public_html
166 Alias /~wims $wimshome/public_html
167
168 <Directory $wimshome/public_html>
169 Options +FollowSymLinks +ExecCGI -Indexes
170 AllowOverride All
171 $require_line
172 </Directory>
173 <Directory $wimshome/public_html/modules>
174 Options FollowSymLinks
175 AllowOverride Limit
176 </Directory>
177
178 ###### $endl! ######
179 @
180
181 mv $tmpfile $conffile
182
183 initdir=/etc/init.d
184 [ -d $initdir ] || initdir=/etc/rc.d/init.d
185 initscript=$initdir/httpd
186 [ -f $initscript ] || initscript=$initdir/apache
187 if [ -f $initscript ]; then
188 $initscript restart
189 else
190 echo
191 echo Now you must restart your httpd to make the new configuration
192 echo take effect.
193 echo If you don\'t know how to do so: just shut down the system then
194 echo restart it.
195 echo
196 fi
197
génère malgré tout le me message d'erreur suivant :
Message erreur
wims@Family:/var/www/wims/bin$ sudo sh ./apache-config
./apache-config: 28: ./apache-config: httpd: not found
./apache-config: 29: ./apache-config: apache: not found
[Mon Mar 09 16:00:43.977172 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon Mar 09 16:00:43.977223 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Mar 09 16:00:43.977233 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Mar 09 16:00:43.977239 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Mar 09 16:00:43.977247 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Mar 09 16:00:43.981863 2015] [core:warn] [pid 17238] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 72 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
dirname: missing operand
Try 'dirname --help' for more information.
Unknown web server. Version too early?
Please first update your web server to Apache >=1.3.
Bilan. Quel est le problème posé au niveau du script par la variable d'environnement $APACHE_LOCK_DIR, alors qu'elle semble a priori renseigné au niveau du test ?
Bien sûr je n'ai rien trouvé de probant sur les forums concernant ne serait-ce que le sens à donner au message Invalid Mutex directory in argument file:${APACHE_LOCK_DIR} dans le fichier de configuration apache2.conf.
70 # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
71 #
72 Mutex file:${APACHE_LOCK_DIR} default
73
74 #
75 # PidFile: The file in which the server should record its process
76 # identification number when it starts.
77 # This needs to be set in /etc/apache2/envvars
78 #
79 PidFile ${APACHE_PID_FILE}
80
Si quelqu'un s'y retrouve dans cette usine à gaz ????
Cordialement
Dernière modification par Jtomoise (Le 09/03/2015, à 19:31)
Hors ligne
#2 Le 09/03/2015, à 20:06
- gl38
Re : Problème de script bash avec WIMS
Comme je me suis servi de WIMS il y a quelques années, je m'y suis remis.
Ce n'est pas trop facile !
Comme le dit la doc d'ubuntu, les paquets ne marchent pas, c'est bien dommage.
Bon, je télécharge le fichier wims-4.09d.tgz, ici
Je crée un utilisateur wims qui a son dossier perso dans /home/wims
Je décompacte le wims-4.09d.tgz dans /home/wims.
Je lance le compile qui est dedans, il faut ajouter plusieurs trucs, mais là synaptic fait son boulot.
Je lis le README, et je lance le ./bin/setwrapexec
Il faut que tout dans /home/wims à wims et à son groupe
Je lance le ./bin/apache-config, je réponds aux questions, IP, mot de passe, adresse mail...
et je relance apache et ça marche !!!
Voilà, si ça peut aider.
Cordialement,
Guy
Dernière modification par gl38 (Le 09/03/2015, à 20:29)
Hors ligne
#3 Le 10/03/2015, à 11:24
- Jtomoise
Re : Problème de script bash avec WIMS
Merci Guy
Comme toi, j'ai par le passé, et à plusieurs reprises, installé WIMS et tjs par le tar ball (tout simplement parce que je le faisais sous mandriva 32bits). Je confirme que cela avait nécessité quelques modifications du type liens symboliques à créer et modification/adaptation de certains scripts (avec bien sûr remontées ensuite dans le FAQ). Moyennant quoi l'installation était devenue brève et effective.
Je n'ai donc pas voulu changer mes habitudes et ai donc eu recours au tar ball que tu indiques, à savoir wims-4.09d.tgz, pour essayer d'installer WIMS sous Ubuntu (64 bits). Mon objectif est de faire tourner Moodle, Wims et bigbluebutton de concert... Pour ce qui concerne Moodle et BBB, les tutos et les packages Ubuntu n'ont pas leur égal (Attention toutefois de prendre soin d'installer nginx via le package de BBB) !!!! Il me reste donc à surmonter l'épreuve WIMS...
J'ai respecté la démarche que tu prescris mais il y a un problème avec apache2 comme le laisse supposer la description initiale du pb que je rencontre. Quelque chose ne colle pas entre la bibliothèque partagée /usr/sbin/apache2, le script /etc/apache2/envvars (et peut-être apache2.conf ???) . Je rappelle que l'exécution de /usr/sbin/apache2 m'annonce que certaines variables d'environnement ne sont pas définies alors qu'un echo sur ces mêmes variables indique bien qu'elles sont implémentées avec les valeurs correctes...
C'est parce que je pense a priori qu'il s'agit d'un pb d'écriture des scripts (qui appellent probablement des adaptations à mon système ???) que j'ai déposé ce tip dans le forum Terminal, scripts et ligne de commande plutôt que sur le forum serveurs (apache2 en l'occurrence)...
Cordialement
JM
Hors ligne
#4 Le 10/03/2015, à 12:12
- gl38
Re : Problème de script bash avec WIMS
D'après cette page nginx est une alternative à apache : est-ce que les 2 fonctionnent ensemble sans problème. J'en doute.
Moi je n'ai qu'apache et pas bigbluebutton, qui a un nom qui ne rappelle pas que des bons souvenirs...
En ce qui concerne les variables, chez moi APACHE_LOCK_DIR est vide !
Je n'ai pas changé de liens. Le seul souci est venu du sudo, vu que wims a l'air de préférer su, mais comme depuis toujours j'ai un utilisateur root en état de marche et que je sais changer les droits,
Cordialement,
Guy
Hors ligne
#5 Le 10/03/2015, à 18:37
- Jtomoise
Re : Problème de script bash avec WIMS
En fait, j'ai fait en sorte que nginx écoute sur le port 80 et apache2 sur le port 82.
Ainsi moodle fonctionne et son module BBB aussi. module.
Tu me dis que : "En ce qui concerne les variables, chez moi APACHE_LOCK_DIR est vide !"
Et l'exécution de apache-config (de WIMS bien sûr) ne te renvoie pas le message suivant ?
wims@Family:/home/wims$ sudo ./bin/apache-config
debian
./bin/apache-config: 29: ./bin/apache-config: httpd: not found
./bin/apache-config: 30: ./bin/apache-config: apache: not found
[Tue Mar 10 17:35:51.392474 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Tue Mar 10 17:35:51.392516 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Tue Mar 10 17:35:51.392526 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Tue Mar 10 17:35:51.392532 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Tue Mar 10 17:35:51.392539 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Mar 10 17:35:51.396979 2015] [core:warn] [pid 6069] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 72 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
[Tue Mar 10 17:35:51.422630 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Tue Mar 10 17:35:51.422677 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Tue Mar 10 17:35:51.422688 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Tue Mar 10 17:35:51.422696 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Tue Mar 10 17:35:51.422705 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Tue Mar 10 17:35:51.427635 2015] [core:warn] [pid 6074] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 72 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
./bin/apache-config: 46: ./bin/apache-config: conffile: not found
dirname: missing operand
Try 'dirname --help' for more information.
Unknown web server. Version too early?
Please first update your web server to Apache >=1.3.
@+
et merci encore
JM
Hors ligne
#6 Le 10/03/2015, à 22:37
- gl38
Re : Problème de script bash avec WIMS
Chez moi, il n'y a pas eu de message d'erreur.
Je ne comprends pas pourquoi chez toi le script affiche debian, httpd, apache, tout ce qui est après un signe =.
Comment as-tu créé l'utilisateur wims ? Pourquoi un simple shell ne s'exécute pas correctement ?
Cordialement,
Guy
Hors ligne
#7 Le 11/03/2015, à 00:01
- Jtomoise
Re : Problème de script bash avec WIMS
Bonsoir Guy
Pour essayer d'y voir plus clair, je te renvoie ci-dessous le script apache-config
wims@Family:/home/wims$ sudo cat -n ./bin/apache-config
[sudo] password for wims:
1 #! /bin/sh
2 #
3 # This script adds WIMS-related definitions to Apache config.
4 # It must be run as root.
5 #
6 # If you want to prohibit the action of this script,
7 # insert the following word to httpd.conf (in a commented line):
8 # manually_configured_for_wims
9 #
10
11 if [ ! "$(id -ru )" = 0 ]; then
12 echo
13 echo This script adds WIMS-related definitions to Apache config.
14 echo It must be run as root.
15 echo
16 echo su to root before running this script!
17 echo
18 echo
19 exit
20 fi
21
22 distro=default
23 [ -f /etc/debian_version ] && distro=debian
24 echo $distro
25 PATH=$PATH:/usr/sbin:/sbin
26 export PATH
27
28 # httpd or apache?
29 httpd -v >/dev/null && httpdname=httpd
30 if [ -z "$httpdname" ]; then apache -v >/dev/null && httpdname=apache; fi
31 if [ -z "$httpdname" ]; then apache2 -v >/dev/null && httpdname=apache2; fi
32 if [ -z "$httpdname" ]; then httpd2 -v >/dev/null && httpdname=httpd2; fi
33 if [ -z "$httpdname" ]; then
34 cat <<@
35
36 Apache is not found on your system.
37 WIMS requires a running web server Apache.
38 Please first install Apache (>=1.3).
39
40 @
41 exit
42 fi
43
44 `$httpdname -V | grep SERVER_CONFIG_FILE | awk -F'=' '{print $2}' | tr -d ' "'`
45
46 conffile =`$httpdname -V | grep SERVER_CONFIG_FILE | awk -F'=' '{print $2}' | tr -d ' "'`
47
48 confdir=`dirname $conffile`
49 if [ -z "$confdir" ]; then
50 cat <<@
51
52 Unknown web server. Version too early?
53 Please first update your web server to Apache >=1.3.
54
55 @
56 exit
57 fi
58
59 case $distro in
60 debian conffile=$confdir/conf.d/wims.conf
61
62 ;;
63 esac
64
65 cd `dirname $0`/..
66 wimshome=`pwd`
67
68 if [ ! -e public_html/wims.cgi ] || [ ! -e bin/apache-config ]; then
69 echo Error: wrong directory. File wims.cgi not found.
70 echo
71 exit
72 fi
73
74 httpdroot=`$httpdname -V | grep HTTPD_ROOT | awk -F'=' '{print $2}' | tr -d ' "'`
75 if [ ! -z "$httpdroot" ]; then cd $httpdroot; fi
76
77 tmpfile=/tmp/wims-apache.conf
78 vtest=`$httpdname -v | grep Apache`
79 if [ -z "$vtest" ]; then
80 echo
81 echo You are not running Apache web server!
82 echo
83 echo You must configure manually your web server, this script cannot be used.
84 echo
85 exit
86 fi
87
88 conftest=`grep -i manually_configured_for_wims $conffile`
89 if [ ! -z "$conftest" ]; then
90 echo Manually configured $conffile not modified.
91 exit
92 fi
93
94 # The next two definitions should NEVER be changed.
95 startl="WIMS definitions start. Do not alter this line"
96 endl="WIMS definitions end. Do not alter this line"
97
98 case $distro in
99 debian) rm -f $tmpfile
100 ;;
101 *) awk 'BEGIN {a=1};
102 /'"$startl"'/ {a=0};
103 a==1 {print};
104 /'"$endl"'/ {a=1};' $conffile >$tmpfile
105 ;;
106 esac
107
108 if [ "$1" = "uninstall" ]; then
109 case $distro in
110 debian) rm -f $conffile $tmpfile
111 ;;
112 *) mv $tmpfile $conffile
113 ;;
114 esac
115 killall -HUP $httpdname
116 exit
117 fi
118
119 cat >>$tmpfile <<@
120 ###### $startl! ######
121 #
122 # If you manually add things concerning WIMS into this configuration file,
123 # add them BEFORE the 'WIMS definition start' line.
124 # Otherwise the addition will be erased in next update.
125 #
126 AddHandler cgi-script .cgi
127 @
128
129 # $vtest looks like "Server version: Apache/X.Y.Z Unix"
130 # $vmajor will be XY
131
132 vmajor=`echo $vtest | grep 'pache' | perl -pe 's/.*pache\/([\d]+).([\d]+).*/$1$2/'`
133
134 # Apache version == 1.2
135 if [ "$vmajor" = "12" ]; then
136 cat >>$tmpfile <<@
137 ScriptAlias /wims/wims.cgi $wimshome/public_html/wims.cgi
138 ScriptAlias /wims/wims.html $wimshome/public_html/wims.cgi
139 ScriptAlias /wims/index.html $wimshome/public_html/wims.cgi
140 ScriptAlias /wims/wims.gif $wimshome/public_html/wims.cgi
141 ScriptAlias /wims/wims.png $wimshome/public_html/wims.cgi
142 ScriptAlias /wims/wims.jpeg $wimshome/public_html/wims.cgi
143 ScriptAlias /wims/wims.jpg $wimshome/public_html/wims.cgi
144 @
145 # newer versions of Apache
146 else
147 cat >>$tmpfile <<@
148 ScriptAliasMatch ^/~wims/wims\.(.*) $wimshome/public_html/wims.cgi
149 ScriptAliasMatch ^/wims/wims\.(.*) $wimshome/public_html/wims.cgi
150 ScriptAliasMatch ^/~wims/index\.(.*) $wimshome/public_html/wims.cgi
151 ScriptAliasMatch ^/wims/index\.(.*) $wimshome/public_html/wims.cgi
152 ScriptAliasMatch ^/~wims/.._(.*).html $wimshome/public_html/wims.cgi
153 ScriptAliasMatch ^/wims/.._(.*).html $wimshome/public_html/wims.cgi
154 ScriptAliasMatch ^/~wims/getfile/(.*) $wimshome/public_html/wims.cgi
155 ScriptAliasMatch ^/wims/getfile/(.*) $wimshome/public_html/wims.cgi
156 ScriptAlias /wims/....\.cgi $wimshome/public_html/wims.cgi
157 @
158 fi
159
160 # Apache version >= 2.4
161 if [ "$vmajor" -ge "24" ]; then
162 require_line="Require all granted"
163 # Older Apache versions
164 else
165 require_line="allow from all"
166 fi
167
168 cat >>$tmpfile <<@
169 Alias /wims $wimshome/public_html
170 Alias /~wims $wimshome/public_html
171
172 <Directory $wimshome/public_html>
173 Options +FollowSymLinks +ExecCGI -Indexes
174 AllowOverride All
175 $require_line
176 </Directory>
177 <Directory $wimshome/public_html/modules>
178 Options FollowSymLinks
179 AllowOverride Limit
180 </Directory>
181
182 ###### $endl! ######
183 @
184
185 mv $tmpfile $conffile
186
187 initdir=/etc/init.d
188 [ -d $initdir ] || initdir=/etc/rc.d/init.d
189 initscript=$initdir/httpd
190 [ -f $initscript ] || initscript=$initdir/apache
191 if [ -f $initscript ]; then
192 $initscript restart
193 else
194 echo
195 echo Now you must restart your httpd to make the new configuration
196 echo take effect.
197 echo If you do not know how to do so: just shut down the system then
198 echo restart it.
199 echo
200 fi
]
avec les lignes numérotées. Lignes que je vais essayer d'interpréter pour tenter de répondre à tes questions (du moins, je le pense...)
le script affiche debian en réponse semble-t-il à la ligne 24.
httpd, apache en réponse, je pense, aux lignes 29 et 30.
A priori, le script commence à péter les plombs lors de l'interprétation des lignes 43 à 49....
J'ai par ailleurs créé l'utilisateur wims par paramètres systèmes > Comptes utilisateurs de ma version Ubuntu 14.04 LTS (64 bits).
De ton côté, peux-tu me dire quelle version de Ubuntu tu utilises ? et éventuellement le résultat chez toi de la commande
printenv | less ?
Mais aussi de :
/usr/sbin/apache2ctl -V
Chez moi, cette dernière donne :
wims@Family:/home/wims$ sudo /usr/sbin/apache2ctl -V
[sudo] password for wims:
Server version: Apache/2.4.7 (Ubuntu)
Server built: Jul 22 2014 14:36:38
Server's Module Magic Number: 20120211:27
Server loaded: APR 1.5.1-dev, APR-UTIL 1.5.3
Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-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=256
-D HTTPD_ROOT="/etc/apache2"
-D SUEXEC_BIN="/usr/lib/apache2/suexec"
-D DEFAULT_PIDLOG="/var/run/apache2.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="mime.types"
-D SERVER_CONFIG_FILE="apache2.conf"
J'aimerais pouvoir éliminer un pb d'encodage mais comment ?
Ton serveur web est-il apache (avec le traditionnel httpd.conf) ou comme chez moi apache2 avec apache2.conf et les répertoires (sites-available, ...) et scripts (envvars) nécessaires et multiples qui l'accompagnent ?
Mille mercis.
Cordialement
JM
Dernière modification par Jtomoise (Le 11/03/2015, à 00:03)
Hors ligne
#8 Le 11/03/2015, à 09:47
- gl38
Re : Problème de script bash avec WIMS
Je n'ai pas tout à fait le même apache-config que toi. Je n'ai pas la ligne
echo $distro
ce qui explique l'absence de l'affichage de debian.
Voici mon fichier
#! /bin/sh
#
# This script adds WIMS-related definitions to Apache config.
# It must be run as root.
#
# If you want to prohibit the action of this script,
# insert the following word to httpd.conf (in a commented line):
# manually_configured_for_wims
#
if [ ! "$(id -ru )" = 0 ]; then
echo
echo This script adds WIMS-related definitions to Apache config.
echo It must be run as root.
echo
echo su to root before running this script!
echo
echo
exit
fi
distro=default
[ -f /etc/debian_version ] && distro=debian
PATH=$PATH:/usr/sbin:/sbin
export PATH
# httpd or apache?
httpd -v >/dev/null && httpdname=httpd
if [ -z "$httpdname" ]; then apache -v >/dev/null && httpdname=apache; fi
if [ -z "$httpdname" ]; then apache2 -v >/dev/null && httpdname=apache2; fi
if [ -z "$httpdname" ]; then httpd2 -v >/dev/null && httpdname=httpd2; fi
if [ -z "$httpdname" ]; then
cat <<@
Apache is not found on your system.
WIMS requires a running web server Apache.
Please first install Apache (>=1.3).
@
exit
fi
[ -f /etc/apache2/envvars ] && . /etc/apache2/envvars
conffile=`$httpdname -V | grep SERVER_CONFIG_FILE | awk -F'=' '{print $2}' | tr -d ' "'`
confdir=`dirname $conffile`
if [ -z "$confdir" ]; then
cat <<@
Unknown web server. Version too early?
Please first update your web server to Apache >=1.3.
@
exit
fi
case $distro in
debian) if [ `lsb_release -c | cut -f2` = "trusty" ];then
conffile=$confdir/conf-enabled/wims.conf
else
conffile=$confdir/conf.d/wims.conf
fi
;;
esac
cd `dirname $0`/..
wimshome=`pwd`
if [ ! -e public_html/wims.cgi ] || [ ! -e bin/apache-config ]; then
echo Error: wrong directory. File wims.cgi not found.
echo
exit
fi
httpdroot=`$httpdname -V | grep HTTPD_ROOT | awk -F'=' '{print $2}' \
| tr -d ' "'`
if [ ! -z "$httpdroot" ]; then cd $httpdroot; fi
tmpfile=/tmp/wims-apache.conf
vtest=`$httpdname -v | grep Apache`
if [ -z "$vtest" ]; then
echo
echo You are not running Apache web server!
echo
echo You must configure manually your web server, this script cannot be used.
echo
exit
fi
conftest=`grep -i manually_configured_for_wims $conffile`
if [ ! -z "$conftest" ]; then
echo Manually configured $conffile not modified.
exit
fi
# The next two definitions should NEVER be changed.
startl="WIMS definitions start. Do not alter this line"
endl="WIMS definitions end. Do not alter this line"
case $distro in
debian) rm -f $tmpfile
;;
*) awk 'BEGIN {a=1};
/'"$startl"'/ {a=0};
a==1 {print};
/'"$endl"'/ {a=1};' $conffile >$tmpfile
;;
esac
if [ "$1" = "uninstall" ]; then
case $distro in
debian) rm -f $conffile $tmpfile
;;
*) mv $tmpfile $conffile
;;
esac
killall -HUP $httpdname
exit
fi
cat >>$tmpfile <<@
###### $startl! ######
#
# If you manually add things concerning WIMS into this configuration file,
# add them BEFORE the 'WIMS definition start' line.
# Otherwise the addition will be erased in next update.
#
AddHandler cgi-script .cgi
@
# $vtest looks like "Server version: Apache/X.Y.Z (Unix)"
# $vmajor will be XY
vmajor=`echo $vtest | grep 'pache' | perl -pe 's/.*pache\/([\d]+).([\d]+).*/$1$2/'`
# Apache version == 1.2
if [ "$vmajor" = "12" ]; then
cat >>$tmpfile <<@
ScriptAlias /wims/wims.cgi $wimshome/public_html/wims.cgi
ScriptAlias /wims/wims.html $wimshome/public_html/wims.cgi
ScriptAlias /wims/index.html $wimshome/public_html/wims.cgi
ScriptAlias /wims/wims.gif $wimshome/public_html/wims.cgi
ScriptAlias /wims/wims.png $wimshome/public_html/wims.cgi
ScriptAlias /wims/wims.jpeg $wimshome/public_html/wims.cgi
ScriptAlias /wims/wims.jpg $wimshome/public_html/wims.cgi
@
# newer versions of Apache
else
cat >>$tmpfile <<@
ScriptAliasMatch ^/~wims/wims\.(.*) $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/wims/wims\.(.*) $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/~wims/index\.(.*) $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/wims/index\.(.*) $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/~wims/.._(.*).html $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/wims/.._(.*).html $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/~wims/getfile/(.*) $wimshome/public_html/wims.cgi
ScriptAliasMatch ^/wims/getfile/(.*) $wimshome/public_html/wims.cgi
ScriptAlias /wims/....\.cgi $wimshome/public_html/wims.cgi
@
fi
# Apache version >= 2.4
if [ "$vmajor" -ge "24" ]; then
require_line="Require all granted"
# Older Apache versions
else
require_line="allow from all"
fi
cat >>$tmpfile <<@
Alias /wims $wimshome/public_html
Alias /~wims $wimshome/public_html
<Directory $wimshome/public_html>
Options +FollowSymLinks +ExecCGI -Indexes
AllowOverride All
$require_line
</Directory>
<Directory $wimshome/public_html/modules>
Options FollowSymLinks
AllowOverride Limit
</Directory>
###### $endl! ######
@
mv $tmpfile $conffile
initdir=/etc/init.d
[ -d $initdir ] || initdir=/etc/rc.d/init.d
initscript=$initdir/httpd
[ -f $initscript ] || initscript=$initdir/apache
if [ -f $initscript ]; then
$initscript restart
else
echo
echo Now you must restart your httpd to make the new configuration
echo take effect.
echo If you don\'t know how to do so: just shut down the system then
echo restart it.
echo
fi
Comment se fait-il que nos 2 fichiers ne soient pas identiques ?
J'utilise ubuntu 12.04 et j'ai bien un apache2.
Cordialement,
Guy
Hors ligne
#9 Le 11/03/2015, à 19:24
- gl38
Re : Problème de script bash avec WIMS
J'ai essayé avec un dvd-live de Cubuntu 14.04.
J'ai créé un utilisateur wims qui s'est mis dans /home/wims
j'y ai copié l'archive wims-4.09d.tgz, je l'ai installé, compilé, en ajoutant libgd2-xpm-dev, bison, flex.
J'ai ajouté apache2, ajouté le module pour avoir les cgi, modifié le fichier de default pour autoriser les cgi.
Et voilà, ça marche ! (après un peu plus d'une heure d'effort, surtout pour le cgi dont j'avais oublié comment on le met en marche)
Donc, je pense que le fichier apache-config (enfin, le mien) marche très bien, ainsi qu'ubuntu.
Ton problème vient d'ailleurs.
Puisque tu dis que vous êtes plusieurs, je suggère que vous fassiez une installation neuve d'ubuntu sur laquelle vous installez d'abord wims puis les autres logiciels pour essayer de voir qui est responsable de votre problème.
Au passage, je recommande très fort Cubuntu et Mate.
Cordialement,
Guy
Hors ligne
#10 Le 12/03/2015, à 21:10
- Jtomoise
Re : Problème de script bash avec WIMS
Merci Guy
J'ai regardé le fichier apache-config que tu m'avais fait parvenir et j'ai remarqué que le mien ne disposait pas de la ligne
42 [ -f /etc/apache2/envvars ] && . /etc/apache2/envvars
Ce que je soupçonnais après avoir en particulier constaté que l'instruction
source /etc/apache2/envvars (variables d'environnement)
permettaiit ensuite un fonctionnement correct de :
apache2 -V
Je suis très intéressé par ta nouvelle installation et en particulier par
"ajouté le module pour avoir les cgi, modifié le fichier de default pour autoriser les cgi"
et la manière avec laquelle tu as "modifié le fichier de default". (le 000-default.conf de apache 2 ?)
Pourrais-tu, je te prie, me donner des indications sur ces deux points et me faire si possible parvenir ta dernière mouture de :
1°) apache-conf (de wims)
2°) ton 000-default.conf de apache2 ?
Amicalement
JM
Hors ligne
#11 Le 12/03/2015, à 22:30
- gl38
Re : Problème de script bash avec WIMS
Le fichier apache-config que j'utilise est celui qui vient de l'archive wims-4.09d.tgz. Je n'ai rien changé dedans pour aucun de mes essais. C'est celui que j'ai affiché plus haut.
Pour que les cgi s'exécutent et ne s'affichent pas, il convient de faire
sudo a2enmod cgi
sudo service apache2 restart
Dans mon dernier essai avec un DVD-live de Cubuntu persistant (les changements sont stockés sur une clé USB) ça a suffi. Avant j'avais dû ajouter quelque chose dans le fichier 000-default.conf du genre :
AddHandler cgi-script .cgi .pl
<Files ~ "\.pl$">
Options +ExecCGI
</Files>
<Files ~ "\.cgi$">
Options +ExecCGI
</Files>
Cordialement,
Guy
Hors ligne
#12 Le 13/03/2015, à 09:47
- Jtomoise
Re : Problème de script bash avec WIMS
Bonjour Guy
A la suite de nos entretiens les choses évoluent. J'avais en particulier oublié d'exécuter la commande :
sudo a2enmod cgi
Je n'ai pas cherché à réinstaller une autre version de wims, Ne serait-ce dans l'immédiat que pour y voir plus clair dans mon pb...
J'ai maintenant déposé une nouvelle discussion : pb php5 et appache2
sur le forum Serveurs. A consulter bien sûr...;)
JM
Hors ligne