Sponsor:

Server and Web Integrator
Link:
Kloxo-MR logo
6.5.0 or 7.0.0
Click for "How to install"
Donation/Sponsorship:
Kloxo-MR is open-source.
Donate and or Sponsorship always welcome.
Click to:
Click Here
Please login or register. 2019-07-16, 16:47:19

Author Topic: CGI script won't execute  (Read 143 times)

0 Members and 1 Guest are viewing this topic.

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
CGI script won't execute
« on: 2019-06-11, 18:49:34 »
Hi all,

I just moved from virtualmin/webmin to Kloxo-MR
I managed to use this great webpanel and add my website online and ready to use.

However, I canno't find the way to execute "test.cgi" in the folder "cgi-bin"
The page will show the source code instead of executing the script...

I'm lost in finding the good config to make it work, please help, many thanks !

***
Using : Lighthttpd + PHP56u+PHP-fpm_event

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #1 on: 2019-06-11, 19:42:33 »
Set chmod for file(s) inside /cgi-bin to 755.

Please inform 'sh /script/sysinfo'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #2 on: 2019-06-12, 05:41:24 »
Hi Mustafa,

Yes, CHMOD is set to 755...

SYSINFO

A. Control Panel:
   - Kloxo-MR: 7.0.0.c-2019061001
   - Web: hiawatha-10.9.0-f.1.mr.el7.x86_64
   - PHP: php56s - 5.6.40-1.ius.el7 (fpm mode)
B. Plateform:
   - OS: CentOS Linux release 7.6.1810 (Core) x86_64
   - Hostname: mail
C. Services:
   1. MySQL: MariaDB-server-10.0.38-1.el7.centos.x86_64
   2. PHP:
      - Installed:
        - Branch: php56u-cli-5.6.40-1.ius.el7.x86_64
      - Used: --PHP Branch--
      - Multiple: disable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.9.0-f.1.mr.el7.x86_64
     - Lighttpd: lighttpd-1.4.53-1.el7.x86_64
     - Nginx: nginx-1.17.0-1.el7.ngx.x86_64
     - Apache: httpd24u-2.4.39-1.ius.el7.x86_64
       - PHP Type: php-fpm_event
       - Secondary PHP: on
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: bind
     - Bind: bind-9.9.9-1.mr.el7.x86_64
     - DJBDns: djbdns-1.05-17.4.mr.el7.x86_64
     - NSD: nsd-4.1.24-2.el7.x86_64
     - PowerDNS: pdns-4.0.3-1.el7.MIND.x86_64
     - Yadifa: yadifa-2.3.9-1.el7.x86_64
   6. Mail: qmail-toaster-1.03-1.3.57.mr.el7.x86_64
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el7.x86_64
      - smtp: qmail-toaster-1.03-1.3.57.mr.el7.x86_64
      - spam: bogofilter-1.2.3-6.el7.x86_64
   7. FTP: pure-ftpd
      - pure-ftpd: pure-ftpd-1.0.47-2.el7.x86_64
   8. Stats: awstats
      - awstats: kloxomr-stats-awstats-7.6-1.mr.noarch
D. Memory:
              total        used        free      shared  buff/cache   available
Mem:           2048         182        1550           2         315        1727
Swap:             0           0           0
E. Disk Space:
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs       50G  2.6G   48G   6% /


*** Process Time: 00:00:00:37.37138 (dd:hh:mm:ss:xxxxxx) ***

* Note: run 'sh /script/sysinfo -y' if you want run 'fix-service-list' also
        (importance after Kloxo-MR update)


Any idea ?
« Last Edit: 2019-06-12, 17:44:16 by SbkloxoMr »

Offline athien

  • Newbie
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #3 on: 2019-06-12, 09:42:30 »
mod_cgi was disabled by default maybe,
uncomment all line this file
Code: [Select]
/etc/httpd/conf.modules.d/01-cgi.confAvoiding update overwrite this file change the file name ex: 01-cgii.conf

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #4 on: 2019-06-12, 09:48:23 »
Did your file content (above line):
Code: [Select]
#!/usr/bin/perl
use strict;
use warnings;
 
print qq(Content-type: text/plain\n\n);
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #5 on: 2019-06-12, 17:05:48 »
I tried so many things that I believe I broke the server lol
So I reinstalled Centos7/Kloxo-MR, added my website, and when I tried to add SSL cert, It was impossible so I changed from lighthttpd to Nginx and SSL cert was created properly.

But I still have troubles with any .cgi file, this is the test file I'm using actually :

#!/usr/bin/perl

##########################################################
# Server Test v2.1 22/August/2003
# © 2003 http://www.EZscripting.co.uk/
##########################################################
# EZscripting.co.uk © 1999 - 2004
# The scripts are available for private and commercial use.
# You can use the scripts in any website you build.
# It is prohibited to sell the scripts in any format to anybody.
# The scripts may only be distributed by EZscripting.co.uk.
# The redistribution of modified versions of the scripts is prohibited.
# EZscripting.co.uk accepts no responsibility or liability
# whatsoever for any damages however caused when using our services or scripts.
# By downloading and using this script you agree to the terms and conditions.
##########################################################
# Upload this script into the directory you are going to use for the script
# CHMOD this 755 or 777 if not public
# Run the script by typing the URL in your browser
# You should now see your PATH and URL information
##########################################################

print "Content-type: text/html\n\n";
print "<html>\n" ;
print "\n" ;
print "<head>\n" ;
print "<title>$ENV{'SERVER_NAME'} EZscripting.co.uk Server Test</title>\n" ;
print "</head>\n" ;
print "\n" ;

print "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\">\n" ;
print "\n" ;

print "<center><font face=Verdana size=3><b><br>\n" ;
print "EZscripting.co.uk CGI Help Script</b></center>\n" ;

print "<font face=Verdana size=2><b><br><br>\n" ;
print "Path and URL information:</b><br><br>\n" ;
print "Your path to Perl is correct<br>\n" ;
print "Your server is running Perl version: $]<br>\n" ;
print "Your domain name is: $ENV{'SERVER_NAME'}<br>\n" ;
print "The complete system PATH to this script is: $ENV{'SCRIPT_FILENAME'}<br>\n" ;
print "The URL of this script is: http://$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}<br>\n" ;

print "</body>\n" ;
print "</html>\n" ;

##########################################################
# EZscripting.co.uk © 1999 - 2004
# The scripts are available for private and commercial use.
# You can use the scripts in any website you build.
# It is prohibited to sell the scripts in any format to anybody.
# The scripts may only be distributed by EZscripting.co.uk.
# The redistribution of modified versions of the scripts is prohibited.
# EZscripting.co.uk accepts no responsibility or liability
# whatsoever for any damages however caused when using our services or scripts.
# By downloading and using this script you agree to the terms and conditions.
##########################################################


Any chmod : 755/777 will load the kloxo page with Error 502 instead of the .cgi script.

This time, I will not change anything until you tell me what to do, so please kindly let me know.
« Last Edit: 2019-06-12, 17:24:09 by SbkloxoMr »

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #6 on: 2019-06-12, 17:12:05 »
FYI :)

A. Control Panel:
   - Kloxo-MR: 7.0.0.c-2019061001
   - Web: hiawatha-10.9.0-f.1.mr.el7.x86_64
   - PHP: php56s - 5.6.40-1.ius.el7 (fpm mode)
B. Plateform:
   - OS: CentOS Linux release 7.6.1810 (Core) x86_64
   - Hostname: mail
C. Services:
   1. MySQL: MariaDB-server-10.0.38-1.el7.centos.x86_64
   2. PHP:
      - Installed:
        - Branch: php56u-cli-5.6.40-1.ius.el7.x86_64
      - Used: --PHP Branch--
      - Multiple: disable
   3. Web Used: apache
     - Hiawatha: hiawatha-10.9.0-f.1.mr.el7.x86_64
     - Lighttpd: lighttpd-1.4.53-1.el7.x86_64
     - Nginx: nginx-1.17.0-1.el7.ngx.x86_64
     - Apache: httpd24u-2.4.39-1.ius.el7.x86_64
       - PHP Type: php-fpm_event
       - Secondary PHP: on
   4. WebCache: none
     - ATS: --uninstalled--
     - Squid: --uninstalled--
     - Varnish: --uninstalled--
   5. Dns: bind
     - Bind: bind-9.9.9-1.mr.el7.x86_64
     - DJBDns: djbdns-1.05-17.4.mr.el7.x86_64
     - NSD: nsd-4.1.24-2.el7.x86_64
     - PowerDNS: pdns-4.0.3-1.el7.MIND.x86_64
     - Yadifa: yadifa-2.3.9-1.el7.x86_64
   6. Mail: qmail-toaster-1.03-1.3.57.mr.el7.x86_64
      - pop3/imap4: courier-imap-toaster-4.1.2-1.3.20.mr.el7.x86_64
      - smtp: qmail-toaster-1.03-1.3.57.mr.el7.x86_64
      - spam: bogofilter-1.2.3-6.el7.x86_64
   7. FTP: pure-ftpd
      - pure-ftpd: pure-ftpd-1.0.47-2.el7.x86_64
   8. Stats: awstats
      - awstats: kloxomr-stats-awstats-7.6-1.mr.noarch
D. Memory:
              total        used        free      shared  buff/cache   available
Mem:           2048         214         141          51        1692        1692
Swap:             0           0           0
E. Disk Space:
Filesystem      Size  Used Avail Use% Mounted on
/dev/simfs       50G  2.6G   48G   6% /
« Last Edit: 2019-06-12, 17:24:30 by SbkloxoMr »

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #7 on: 2019-06-12, 17:18:23 »
No issue when I tested your code in my website.

See http://rpms.armando.id/cgi-bin/test.pl
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #8 on: 2019-06-12, 17:21:02 »
If still error, give me your Kloxo-MR panel and ssh access.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #9 on: 2019-06-12, 17:21:46 »
No issue when I tested your code in my website.

See http://rpms.armando.id/cgi-bin/test.pl

Hmmm mine domain.com/cgi-bin/test.cgi return :

Error 502 - Bad Gateway
The server either does not recognize the request method, or it lacks the ability to fulfill the request


How comes ?
« Last Edit: 2019-06-12, 17:32:29 by SbkloxoMr »

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #10 on: 2019-06-12, 17:27:16 »
Try rename .cgi to .pl
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #11 on: 2019-06-12, 17:28:02 »
If still error, give me your Kloxo-MR panel and ssh access.

PM sent :)

Online MRatWork

  • Administrator
  • The Elite
  • *****
  • Posts: 15,581
  • Karma: +116/-10
  • Gender: Male
    • View Profile
    • MRatWork Forum
Re: CGI script won't execute
« Reply #12 on: 2019-06-12, 18:25:37 »
Just running 'sh /script/cleanup'.
..:: MRatWork (Mustafa Ramadhan Projects) ::..
-- Server/Web-integrator - Web Hosting (Kloxo-MR READY!) --

Offline SbkloxoMr

  • Newbie
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: CGI script won't execute
« Reply #13 on: 2019-06-12, 18:45:02 »
I tried this, but no chance !

Anyway, problem solved, thanks again !

 


Top 10 Social Networking:    Facebook    Twitter    LinkedIn    Pinterest    Google Plus    Tumblr    Instagram    VK    Flickr    Vine
Click Here

Page created in 0.132 seconds with 24 queries.

web stats analysis