I've been playing around with the various web configurations of J Software on
an Apache2 server. The FSCGI was relatively straight forward and works rather
nicely. But I realized that for most of the small programs I create to play
with it would probably be easier to use Oleg's JHP.
The configuration was relatively straight forward. There were 3 issues one
having to do with Apache 2.4 Directory configuration, the second having to do
with running a virtual server and its DOCUMENT_ROOT location, the third having
to do with the TRANSLATED_PATH in the jhp.sh rewrite script.
Issue 1 and 2
This is about getting CGI working.
Apache 2.4 has done away with the some of the Directory attributes
J Location:
/usr/local/share/j64_803/
Apache configuration file location
/etc/apache2/sites-available/mysite.com.conf
Contents:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName mysite.com
ServerAlias www.mysite.com
DocumentRoot /home/webmaster/www/mysite.com/public_html/
ErrorLog /home/webmaster/www/mysite.com/logs/error.log
CustomLog /home/webmaster/www/mysite.com/logs/access.log combined
<Directory /home/webmaster/www/mysite.com/public_html>
Require all granted
</Directory>
# JHP CGI directory settings. The directories have to be off of
DOCUMENT_ROOT as
# the easiest way to get the CGI and JHP working
ScriptAlias "/cgi-bin/"
"/home/webmaster/www/mysite.com/public_html/cgi-bin/"
<Directory "/home/webmaster/www/mysite.com/public_html/cgi-bin/">
AllowOverride All
Require all granted
<Directory /home/webmaster/www/mysite.com/public_html/jhp>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
With the above settings I was able to get jhp.sh to be found and work. I took
Oleg's troubleshooting advice and made the script dump the Linux env variable
first before I tried a JHP page.
Then the jhp.sh I had to change to:
-------------------
#!/bin/sh
#echo "Content-Type: text/plain"
#echo ""
# The next comment is the original jhp.sh command, but I believe it is
expecting the jhp directory to be a subdirectory of cgi-bin so I hard code it
#export PATH_TRANSLATED=`echo $SCRIPT_NAME | sed -e
's|^/|/home/webmaster/www/mysite.com/public_html/|'`
export PATH_TRANSLATED=/home/webmaster/www/mysite.com/public_html$REQUEST_URI
export JPATHj803=/usr/local/share/j64_803
#env
$JPATHj803/bin/jconsole $JPATHj803/addons/web/jhp/run.ijs "$PATH_TRANSLATED" $*
-------------------
The commented echo's and env statements were for initial debugging. Apache2.4
provides a REQUEST_URI which is /jhp/ht1.jhp in the first trial of Oleg's
examples.
Finally there were some path name issues in the JHP scripts in ~addons/web/jhp
where I stored Oleg's library. I believe there was only 1 in run.ijs where you
need to specify the location of jhp.ijs.
I also had to comment out the line:
NB. USERFOLDERS_j_=: USERFOLDERS_j_,'CGI';CGIDIR_j_;0
in run.ijs. USERFOLDERS_j_ did not seem to be defined but I was able to get the
first few examples working with that change. I don't know what the
ramifications are of doing this.
The nice thing is I have J available on a webserver to play with for my own
amusement. Still trying to figure out that killer app that's gonna put me on
easy street. I provide this more as a way to document getting JHP up and
running under a newer Apache2 server as its security model seems to limit where
you can place your CGI files for this to work where as for SCGI and FSCGI it
let me put the directory where I wanted.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm