PASECGI

PASE.PASECGI History

Hide minor edits - Show changes to output

Added lines 155-157:

!!! Author(s)
Tony "Ranger" Cairns - IBM i PHP / PASE
Added lines 1-3:
Here is a more detailed version of PASE CGI setup (perl), it may help if you have trouble with the short version that follows.
** [[perlSetup]] - PASE perl (by Ryan Watkins)

Deleted line 2:
Changed lines 4-6 from:

(ILE Apache to perl)
to:
(ILE Apache to PASE sh)
Changed lines 6-15 from:
to:
To run when done:
http://myi5:89/sh-htdocs/helloworld.sh

Files when done:
> ls /QOpenSys/sh-bin/*
/QOpenSys/sh-bin/sh-cgi
/QOpenSys/sh-bin/sh-htdocs:
helloworld.sh
>

Deleted line 16:
Changed lines 18-30 from:

2) /QOpenSys/perl-bin/perl-cgi - perl wrapper for perl cgi that will exec $ENV{PATH_TRANSLATED};

3) /QOpenSys/perl-bin/perl-htdocs - directory for perl scripts

*) /QOpenSys/perl-bin/perl-htdocs/helloworld.pl - sample "hello world" perl script

4) /QOpenSys/usr/bin/perl - symbolic link to my perl installation directory



1)
http.conf adds for perl-cgi (conf):
to:
2) /QOpenSys/sh-bin/sh-cgi - sh wrapper for sh cgi that will exec $PATH_TRANSLATED
3) /QOpenSys/sh-bin/sh-htdocs - directory for sh scripts
*) /QOpenSys/sh-bin/sh-htdocs/helloworld.sh - sample "hello world" sh script
4) /QOpenSys/usr/bin/sh - symbolic link to my sh installation

1)
http.conf adds for sh-cgi (conf):
Changed lines 25-35 from:

# perl cgi wrapper program

ScriptAlias
/perl-bin/ /QOpenSys/perl-bin/

AddType application/x-
httpd-perl .pl

Action application/x-httpd-perl /perl-bin/perl-
cgi

<Directory
/QOpenSys/perl-bin>
to:
File: /www/instance/conf/httpd.conf
# sh
cgi wrapper program
ScriptAlias
/sh-bin/ /QOpenSys/sh-bin/
AddType application/x-httpd-sh .sh
Action application/x-httpd-sh /sh-bin/sh-cgi
<Directory /QOpenSys/sh-bin
>
Deleted line 31:
Deleted line 32:
Deleted line 33:
Changed lines 35-41 from:

# perl applications (.pl)

Alias /perl-htdocs /QOpenSys/perl-bin/perl-htdocs

<Location /perl-htdocs>
to:
# sh applications (.sh)
Alias /sh-htdocs /QOpenSys/sh-bin/sh-htdocs
<Location /sh-htdocs>
Deleted line 38:
Deleted line 39:
Changed lines 42-47 from:


2) /QOpenSys/perl-bin/perl-cgi (wrapper):

Note: if ok exec will transfer to new program $ENV{PATH_TRANSLATED},
to:
2) /QOpenSys/sh-bin/sh-cgi (wrapper):
Note: if ok exec will transfer to new program $PATH_TRANSLATED,
Changed lines 45-89 from:

#!/QOpenSys/usr/bin/perl

exec $ENV{PATH_TRANSLATED};

print "Content-Type: text/html;\r\n\r\n";

print "<html>\n";

print " <head>\n";

print " <title>View CGI Environment Variables</title>\n";

print " </head>\n";

print " <body bgcolor=white>\n";

print " <h1>$ENV{PATH_TRANSLATED}</h1>";

print " <h2><font face=helv color=cc9900>CGI Environment

Variables</font></h2>\n";

print " <table cellpadding=3 cellspacing=0 border=1>\n";

foreach $key (sort(keys %ENV))

{

print " <tr><td align=right>$key:</td><td>&nbsp;$ENV{$key}</td></tr>\n";

}

print " </table>\n";

print " </body>\n";

print "</html>\n";

exit(0);



3) perl scripts - /QOpenSys/perl-bin/perl-htdocs (applications/scripts):

to:
File: /QOpenSys/sh-bin/sh-cgi
#!/QOpenSys/usr/bin/sh
exec $PATH_TRANSLATED
echo 'Content-Type: text/html'
echo ''
echo ''
echo '<html>'
echo ' <head>'
echo ' <title>View CGI Environment Variables</title>'
echo ' </head>'
echo ' <body bgcolor=white>'
echo ' <h1>'
echo $PATH_TRANSLATED
echo ' </h1>'
echo ' <h2><font face=helv color=cc9900>CGI Environment Variables</font></h2>'
echo ' <table cellpadding=3 cellspacing=0 border=1>'
echo '<tr><td><pre>'
env
echo '</pre></td></tr>'
echo ' </table>'
echo ' </body>'
echo '</html>'

3) sh scripts - /QOpenSys/sh-bin/sh-htdocs (applications/scripts):
Changed lines 70-79 from:

helloworld.pl
:

#!
/QOpenSys/usr/bin/perl

print
"Content-Type: text/html;\r\n\r\n";

print
"Hello, world!\n";

to:
File:  /QOpenSys/sh-bin/sh-htdocs/helloworld.sh
#!/QOpenSys/usr/bin/sh
echo
"Content-Type: text/html;"
echo ""
echo
""
echo "Hello, world from sh!"
Deleted line 79:
Changed lines 81-83 from:

(ILE Apache to PASE sh)
to:
(ILE Apache to perl)
Changed lines 83-85 from:


to:
To run when done:
http://myi5:89/perl-htdocs/helloworld.pl

Files when done:
> ls /QOpenSys/perl-bin/*
/QOpenSys/perl-bin/perl-cgi
/QOpenSys/perl-bin/perl-htdocs:
helloworld.pl
>

Deleted line 93:
Changed lines 95-109 from:

2) /QOpenSys/sh-bin/sh-cgi - sh wrapper for sh cgi that will exec

$PATH_TRANSLATED

3) /QOpenSys/sh-bin/sh-htdocs - directory for sh scripts

*) /QOpenSys/sh-bin/sh-htdocs/helloworld.sh - sample "hello world" sh script

4) /QOpenSys/usr/bin/sh - symbolic link to my sh installation



1)
http.conf adds for sh-cgi (conf):
to:
2) /QOpenSys/perl-bin/perl-cgi - perl wrapper for perl cgi that will exec $ENV{PATH_TRANSLATED};
3) /QOpenSys/perl-bin/perl-htdocs - directory for perl scripts
*) /QOpenSys/perl-bin/perl-htdocs/helloworld.pl - sample "hello world" perl script
4) /QOpenSys/usr/bin/perl - symbolic link to my perl installation directory

1)
http.conf adds for perl-cgi (conf):
Changed lines 102-114 from:



# sh cgi wrapper program

ScriptAlias
/sh-bin/ /QOpenSys/sh-bin/

AddType application/x-
httpd-sh .sh

Action application/x-httpd-sh /sh-bin/sh-
cgi

<Directory
/QOpenSys/sh-bin>
to:
File: /www/instance/conf/httpd.conf
# perl
cgi wrapper program
ScriptAlias
/perl-bin/ /QOpenSys/perl-bin/
AddType application/x-httpd-perl .pl
Action application/x-httpd-perl /perl-bin/perl-cgi
<Directory /QOpenSys/perl-bin
>
Deleted line 108:
Deleted line 109:
Deleted line 110:
Changed lines 112-118 from:

# sh applications (.sh)

Alias /sh-htdocs /QOpenSys/sh-bin/sh-htdocs

<Location /sh-htdocs>
to:
# perl applications (.pl)
Alias /perl-htdocs /QOpenSys/perl-bin/perl-htdocs
<Location /perl-htdocs>
Deleted line 115:
Deleted line 116:
Changed lines 119-124 from:


2) /QOpenSys/sh-bin/sh-cgi (wrapper):

Note: if ok exec will transfer to new program $PATH_TRANSLATED,
to:
2) /QOpenSys/perl-bin/perl-cgi (wrapper):
Note: if ok exec will transfer to new program $ENV{PATH_TRANSLATED},
Changed lines 122-172 from:



#!/QOpenSys/usr/bin/sh

exec $PATH_TRANSLATED

echo 'Content-Type: text/html'

echo ''

echo ''

echo '<html>'

echo ' <head>'

echo ' <title>View CGI Environment Variables</title>'

echo ' </head>'

echo ' <body bgcolor=white>'

echo ' <h1>'

echo $PATH_TRANSLATED

echo ' </h1>'

echo ' <h2><font face=helv color=cc9900>CGI Environment Variables</font></h2>'

echo ' <table cellpadding=3 cellspacing=0 border=1>'

echo '<tr><td><pre>'

env

echo '</pre></td></tr>'

echo ' </table>'

echo ' </body>'

echo '</html>'





3) sh scripts - /QOpenSys/sh-bin/sh-htdocs (applications/scripts):

to:
File: /QOpenSys/perl-bin/perl-cgi
#!/QOpenSys/usr/bin/perl
exec $ENV{PATH_TRANSLATED};
print "Content-Type: text/html;\r\n\r\n";
print "<html>\n";
print " <head>\n";
print " <title>View CGI Environment Variables</title>\n";
print " </head>\n";
print " <body bgcolor=white>\n";
print " <h1>$ENV{PATH_TRANSLATED}</h1>";
print " <h2><font face=helv color=cc9900>CGI Environment
Variables</font></h2>\n";
print " <table cellpadding=3 cellspacing=0 border=1>\n";
foreach $key (sort(keys %ENV))
{
print " <tr><td align=right>$key:</td><td>&nbsp;$ENV{$key}</td></tr>\n";
}
print " </table>\n";
print " </body>\n";
print "</html>\n";
exit(0);

3) perl scripts - /QOpenSys/perl-bin/perl-htdocs (applications/scripts):
Changed lines 146-162 from:



helloworld.sh
:



#!
/QOpenSys/usr/bin/sh

echo "Content-Type
: text/html;"

echo
""

echo
""

echo "Hello, world from sh!"
@]
to:
File: /QOpenSys/perl-bin/perl-htdocs/helloworld.pl:
#!/QOpenSys/usr/bin/perl
print
"Content-Type: text/html;\r\n\r\n";
print
"Hello, world!\n";
@]
Added lines 1-261:
[@
=========================

setup your Apache web site

(ILE Apache to perl)

=========================

bill of materials / programs (/QOpenSys/...):

1) /www/instance/conf/httpd.conf - ILE Apache configuration

2) /QOpenSys/perl-bin/perl-cgi - perl wrapper for perl cgi that will exec $ENV{PATH_TRANSLATED};

3) /QOpenSys/perl-bin/perl-htdocs - directory for perl scripts

*) /QOpenSys/perl-bin/perl-htdocs/helloworld.pl - sample "hello world" perl script

4) /QOpenSys/usr/bin/perl - symbolic link to my perl installation directory



1) http.conf adds for perl-cgi (conf):

Trick: PASE stuff in PASE IFS directory (/QOpenSys not /www)

# perl cgi wrapper program

ScriptAlias /perl-bin/ /QOpenSys/perl-bin/

AddType application/x-httpd-perl .pl

Action application/x-httpd-perl /perl-bin/perl-cgi

<Directory /QOpenSys/perl-bin>

Options +ExecCGI

order allow,deny

allow from all

</Directory>

# perl applications (.pl)

Alias /perl-htdocs /QOpenSys/perl-bin/perl-htdocs

<Location /perl-htdocs>

Order deny,allow

Allow from all

</Location>



2) /QOpenSys/perl-bin/perl-cgi (wrapper):

Note: if ok exec will transfer to new program $ENV{PATH_TRANSLATED},

so none of the "debug" CGI env will display.

#!/QOpenSys/usr/bin/perl

exec $ENV{PATH_TRANSLATED};

print "Content-Type: text/html;\r\n\r\n";

print "<html>\n";

print " <head>\n";

print " <title>View CGI Environment Variables</title>\n";

print " </head>\n";

print " <body bgcolor=white>\n";

print " <h1>$ENV{PATH_TRANSLATED}</h1>";

print " <h2><font face=helv color=cc9900>CGI Environment

Variables</font></h2>\n";

print " <table cellpadding=3 cellspacing=0 border=1>\n";

foreach $key (sort(keys %ENV))

{

print " <tr><td align=right>$key:</td><td>&nbsp;$ENV{$key}</td></tr>\n";

}

print " </table>\n";

print " </body>\n";

print "</html>\n";

exit(0);



3) perl scripts - /QOpenSys/perl-bin/perl-htdocs (applications/scripts):

Trick: PASE stuff in PASE IFS directory (/QOpenSys not /www)

helloworld.pl:

#!/QOpenSys/usr/bin/perl

print "Content-Type: text/html;\r\n\r\n";

print "Hello, world!\n";


@]

[@
=========================

setup your Apache web site

(ILE Apache to PASE sh)

=========================



bill of materials / programs (/QOpenSys/...):

1) /www/instance/conf/httpd.conf - ILE Apache configuration

2) /QOpenSys/sh-bin/sh-cgi - sh wrapper for sh cgi that will exec

$PATH_TRANSLATED

3) /QOpenSys/sh-bin/sh-htdocs - directory for sh scripts

*) /QOpenSys/sh-bin/sh-htdocs/helloworld.sh - sample "hello world" sh script

4) /QOpenSys/usr/bin/sh - symbolic link to my sh installation



1) http.conf adds for sh-cgi (conf):

Trick: PASE stuff in PASE IFS directory (/QOpenSys not /www)



# sh cgi wrapper program

ScriptAlias /sh-bin/ /QOpenSys/sh-bin/

AddType application/x-httpd-sh .sh

Action application/x-httpd-sh /sh-bin/sh-cgi

<Directory /QOpenSys/sh-bin>

Options +ExecCGI

order allow,deny

allow from all

</Directory>

# sh applications (.sh)

Alias /sh-htdocs /QOpenSys/sh-bin/sh-htdocs

<Location /sh-htdocs>

Order deny,allow

Allow from all

</Location>



2) /QOpenSys/sh-bin/sh-cgi (wrapper):

Note: if ok exec will transfer to new program $PATH_TRANSLATED,

so none of the "debug" CGI env will display.



#!/QOpenSys/usr/bin/sh

exec $PATH_TRANSLATED

echo 'Content-Type: text/html'

echo ''

echo ''

echo '<html>'

echo ' <head>'

echo ' <title>View CGI Environment Variables</title>'

echo ' </head>'

echo ' <body bgcolor=white>'

echo ' <h1>'

echo $PATH_TRANSLATED

echo ' </h1>'

echo ' <h2><font face=helv color=cc9900>CGI Environment Variables</font></h2>'

echo ' <table cellpadding=3 cellspacing=0 border=1>'

echo '<tr><td><pre>'

env

echo '</pre></td></tr>'

echo ' </table>'

echo ' </body>'

echo '</html>'





3) sh scripts - /QOpenSys/sh-bin/sh-htdocs (applications/scripts):

Trick: PASE stuff in PASE IFS directory (/QOpenSys not /www)



helloworld.sh:



#!/QOpenSys/usr/bin/sh

echo "Content-Type: text/html;"

echo ""

echo ""

echo "Hello, world from sh!"
@]