Author Topic: CGI not working CWP with Centos 7  (Read 8744 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
CGI not working CWP with Centos 7
« on: March 01, 2018, 03:34:45 PM »
I followed this (http://wiki.centos-webpanel.com/how-to-run-cgi-scripts-with-apache) and this (http://wiki.centos-webpanel.com/how-to-enable-mod_suexec-with-apache) but I still cannot get CGI working.

When I go to: https://mysite.com/cgi-bin/test.cgi, I get a 500 Internal Server Error.

I get this in the error log:
Code: [Select]
End of script output before headers: test.cgi

I get the following in the suexec log:
Code: [Select]
[2018-03-01 10:25:18]: uid: (1001/jeff) gid: (1001/jeff) cmd: test.cgi
[2018-03-01 10:25:18]: file has no execute permission: (/home/jeff/public_html/cgi-bin/test.cgi)

I used WinSCP to upload 'test.cgi' from a Windows PC to the server and I also used WinSCP to chmod 'test.cgi' to 0755. I also used CWP to fix permissions for the user account.

As per the wiki, I get "cgid_module (shared)" and "suexec_module (shared)" when testing to see if the modules are loaded.

Not sure what to do at this point.

I get the following when I check permissions via command line:
Code: [Select]
[root@cwp ~]# ls -la /home/jeff/public_html/cgi-bin/test.cgi
-rw-r--r-- 1 jeff jeff 98 Feb 28 17:49 /home/jeff/public_html/cgi-bin/test.cgi
« Last Edit: March 01, 2018, 03:41:04 PM by jeffshead »

Re: CGI not working CWP with Centos 7
« Reply #1 on: March 01, 2018, 05:40:57 PM »
check
Code: [Select]
namei -om /home/jeff/public_html/cgi-bin/test.cgi

Offline
*
Re: CGI not working CWP with Centos 7
« Reply #2 on: March 01, 2018, 06:46:00 PM »
check
Code: [Select]
namei -om /home/jeff/public_html/cgi-bin/test.cgi

Code: [Select]
dr-xr-xr-x root     root     /
 drwx--x--x root     root     home
 drwx--x--x jeff jeff jeff
 drwxr-xr-x jeff nobody   public_html
 drwxr-xr-x jeff jeff cgi-bin
 -rw-r--r-- jeff jeff test.cgi

Offline
*
Re: CGI not working CWP with Centos 7
« Reply #3 on: March 01, 2018, 10:09:19 PM »
I see in my previous post that executable was missing but WinSCP showed the file with 0755.

I used 'chmod 755 test.cgi' via SSH and now have the following but I'm still getting the 500 Internal Server Error:
Code: [Select]
[root@cwp ~]# namei -om /home/jeff/public_html/cgi-bin/test.cgi
f: /home/jeff/public_html/cgi-bin/test.cgi
 dr-xr-xr-x root     root     /
 drwx--x--x root     root     home
 drwx--x--x jeff jeff jeff
 drwxr-xr-x jeff nobody   public_html
 drwxr-xr-x jeff jeff cgi-bin
 -rwxr-xr-x jeff jeff test.cgi


Offline
*
Re: CGI not working CWP with Centos 7
« Reply #4 on: March 02, 2018, 01:54:00 AM »
Found the cause.

As I stated in my original post, I used WinSCP to transfer 'test.cgi' from a Windows PC to the CWP server. The issue is described here:
https://stackoverflow.com/a/8629849

I simply used WinSCP to upload the file, once again, but this time I selected "text" as the transfer method.