Thread Unklare Fehlermeldung: Variable "$p1" will not stay shared (46 answers)
Opened by wastl at 2011-02-04 12:30

GwenDragon
 2011-02-05 14:38
#145378 #145378
User since
2005-01-17
14563 Artikel
Admin1
[Homepage]
user image
Stellt sich die Frage, ob du das Programm als mod_perl-Programm laufen lässt.

Meine Apache-Konfiguration für mod_perl 2:
more (1.5kb):
Code: (dl )
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
### config for mod_perl2

LoadModule perl_module "X:\usr\local\apache\modules\mod_perl.so"
LoadModule apreq_module "X:\usr\local\apache\modules\mod_apreq2.so"

<IfModule perl_module>
Alias /perl "X:\usr\local\apache\perl"

PerlRequire "X:\usr\local\apache\conf\extra\startup_modperl2.pl"

<Location /perl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders

Options +ExecCGI

Order allow,deny
Allow from all
</Location>

<Location /perl-status>
SetHandler perl-script
PerlHandler Apache2::Status

Order allow,deny
Allow from 10.0.0.
</Location>

</IfModule>


### Config for CGI
<Location /cgi-bin>
AddHandler cgi-script .pls .plx .cgi .pl

Options +ExecCGI

Order allow,deny
Allow from all
</Location>


mit startup_modperl2.pl:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use Apache2::Status;

use ModPerl::Util ();

use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();
use Apache2::Const -compile => ':common';

use APR::Const -compile => ':common';
use APR::Table ();

use Apache2::compat ();
use ModPerl::Registry ();

use CGI ();

1;


Mein Perl-Programm:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
#!perl.exe
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}


liefert:
more (2.8kb):
Code: (dl )
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
COMSPEC="C:\Windows\system32\cmd.exe"
DOCUMENT_ROOT="X:/var/www/vhosts/test/htdocs"
GATEWAY_INTERFACE="CGI/1.1"
HTTP_ACCEPT="text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1"
HTTP_ACCEPT_CHARSET="iso-8859-1, utf-8, utf-16, *;q=0.1"
HTTP_ACCEPT_ENCODING="deflate, gzip, x-gzip, identity, *;q=0"
HTTP_ACCEPT_LANGUAGE="de,en;q=0.9,de-DE;q=0.8"
HTTP_CONNECTION="Keep-Alive, TE"
HTTP_HOST="server1.intern"
HTTP_TE="deflate, gzip, chunked, identity, trailers"
HTTP_USER_AGENT="Opera/9.80 (Windows NT 6.1; U; de) Presto/2.7.62 Version/11.01"
MOD_PERL="mod_perl/2.0.4"
MOD_PERL_API_VERSION="2"
PATH="X:\bin;X:\usr\bin;X:\local\bin;C:\PROGRA~2\NcFTP;C:\Program Files\TortoiseGit\bin;C:\Program Files\TortoiseSVN\bin;P:\GnuPG;C:\Program Files (x86)\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\"
PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
PHPRC="X:/usr/local/php/5/"
PWD="X:/usr/local/apache/bin"
QUERY_STRING=""
REMOTE_ADDR="10.0.0.98"
REMOTE_PORT="51302"
REQUEST_METHOD="GET"
REQUEST_URI="/perl/test.pl"
SCRIPT_FILENAME="X:/usr/local/apache/perl/test.pl"
SCRIPT_NAME="/perl/test.pl"
SCRIPT_URI="http://server1.intern/perl/test.pl"
SCRIPT_URL="/perl/test.pl"
SERVER_ADDR="10.0.0.98"
SERVER_ADMIN="webmaster@server1.intern"
SERVER_NAME="server1.intern"
SERVER_PORT="80"
SERVER_PROTOCOL="HTTP/1.1"
SERVER_SIGNATURE="<address>Apache/2.2.17 (Win32) mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.8.9 Server at server1.intern Port 80</address>\n"
SERVER_SOFTWARE="Apache/2.2.17 (Win32) mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.8.9"
SystemRoot="C:\Windows"
TEMP="C:\Users\TEST~1\AppData\Local\Temp"
TMP="C:\Users\TEST~1\AppData\Local\Temp"
WINDIR="C:\Windows"



Ich empfehle http://perl.apache.org/docs/index.html als mod_perl-Dokumentation.

Editiert von GwenDragon: Hinweis auf mod_perl-Dokumentation
Last edited: 2011-02-05 14:47:41 +0100 (CET)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread Unklare Fehlermeldung: Variable "$p1" will not stay shared