Linux Mint 18.1にしたら、今まで動いていたCGI(Perl)が動かなくなっていた場合。

私が使わせて頂いているサイトの「100の質問」、「Relm」のCGIは、エラーが出てしまいました。
しかし、昔のPerlを使ったら、しっかりと動いてくれました。

https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/1.7.1/
から、1.7.1のXamppをダウンロードし、その中のPerlを使います。

[crayon]
$ sudo tar -vzxf xampp-linux-1.7.1.tar.gz -C /opt/
$ cd /opt/lampp/bin/
#ここに、昔のPerlが入っております。
[/crayon]

「100.cgi」や、「relm.cgi」の一番最初の行を、次のように変えます。
[crayon]
#!/opt/lampp/bin/perl
[/crayon]

そして、100の質問や、Relmを起動してみてください。
動きましたか?(*^_^*)

elementary OSで、CGI(Perl)を、public_html配下で動かす方法。

[crayon]
# which perl

/usr/bin/perl

# ln -s /usr/bin/perl /usr/local/bin/perl

# apt-get install apache2

# a2enmod userdir

# vi /etc/apache2/mods-enabled/userdir.conf

UserDir public_html
UserDir disabled root


AllowOverride All (変更する。)
Options ExecCGI FollowSymLinks (変更する。)

Order allow,deny
Allow from all


Order deny,allow
Deny from all


# vi /etc/apache2/httpd.conf
AddHandler cgi-script .cgi .pl
ServerName localhost
DirectoryIndex index.html index.htm index.cgi

DocumentRoot /home/USERNAME/public_html/html/hogehoge1
ServerName hoge1.gedatsu.jp


DocumentRoot /home/USERNAME/public_html/html/hogehoge2
ServerName hoge2.gedatsu.jp

# /etc/init.d/apache2 restart
[/crayon]
ここで、Web Patioという、掲示板を試験的にインストールします。

http://www.kent-web.com/bbs/patio.html
から、各自ダウンロードしてください。

このCGIは、FFFTPか、WinSCPなどで、サーバー側に解凍した物をASCII形式でUPLOADしないと、後で、CGIをブラウザで閲覧したら、”Internal Server Error”が表示されます。

お気を付け下さい。

※chmod,chownを適切に行なって下さい。(重要です)
パーミッション”755″にしたい場合には、次のように打ちます。
[crayon]# chmod 755 patio.cgi[/crayon]

“patio”フォルダ以下のファイル所有者を”USERNAME”に設定する場合には、次のように打ちます。
[crayon]# chown -R USERNAME. /home/USERNAME/public_html/html/hogehoge1/patio[/crayon]

“init.cgi”を、各々説明に従って、設定して下さい。
そして、自宅サーバーの場合には、Hosts Fileを変更する。
Hosts Fileの置き場所は、Windows 8.1では、下記の通りです。

[crayon]C:\Windows\System32\Drivers\etc\hosts[/crayon]

LinuxのHosts Fileの置き場所は、[crayon]/etc/hosts[/crayon]です。

[crayon]192.168.0.100 hoge1.gedatsu.jp hoge2.gedatsu.jp[/crayon]
さて、ここまで設定したら、ブラウザで、次のように打って、CGIが表示されるか、確かめましょう。
(例1)http://hoge1.gedatsu.jp/patio/patio.cgi
(例2)http://hoge2.gedatsu.jp/patio/patio.cgi