CGI script return 500 Internal Server Error from web, although work from command line

148 Views Asked by At

OS: AlmaLinux 8.8. Server version: Apache/2.4.37 (AlmaLinux). Command: perl /home/user1/public_html/test.cgi return:

Content-type:text/html

Hello!

File properties: -rwxr-xr-x. 1 nobody nobody unconfined_u:object_r:httpd_sys_script_exec_t:s0 88 Jul 15 12:57 test.cgi

But when you try to run it from the web, like example.com/test.cgi you got the following error: [Sat Jul 15 13:38:50.943316 2023] [cgid:error] [pid 2099193:tid 140664406800128] [client 172.71.182.34:24506] AH01241: error spawning CGI child: exec of '/home/user1/public_html/test.cgi' failed (No such file or directory): /home/user1/public_html/test.cgi [Sat Jul 15 13:38:50.943677 2023] [cgid:error] [pid 2099193:tid 140664406800128] [client 172.71.182.34:24506] End of script output before headers: test.cgi

File exist:

stat /home/user1/public_html/test.cgi
  File: /home/user1/public_html/test.cgi
  Size: 88              Blocks: 8          IO Block: 4096   regular file
Device: fd02h/64770d    Inode: 9729        Links: 1
Access: (0755/-rwxr-xr-x)  Uid: ( 1003/  user1)   Gid: ( 1003/  user1)
Context: unconfined_u:object_r:httpd_sys_script_exec_t:s0
Access: 2023-07-15 12:57:07.393297167 +0300
Modify: 2023-07-15 12:57:01.240297226 +0300
Change: 2023-07-15 13:51:06.171266280 +0300
 Birth: 2023-07-15 12:57:01.240297226 +0300

SELinux in permissive mode:

getenforce
Permissive

Please, help find out what prevent test.cgi from running? Thank you in advance.

I've checked, that http and https are allowed in Firewall.

0

There are 0 best solutions below