Jump to content

[Solved] cgi-bins don't work


z0n1n0z

Recommended Posts

dear administrator,
i can't get cgi-bin programs to work.
The link https://z0n1n0z.helioho.st/cgi-bin/test.cgi is a compiled c++ test program. The source code is at https://z0n1n0z.helioho.st/cgi-bin/test.cpp.
https://z0n1n0z.helioho.st/cgi-bin/test.pl doesn't work either. In cgi-bin/ there is also an .htaccess file which contains this:

Options +ExecCGI
AddHandler cgi-script .cgi .pl .py
LimitRequestBody 2147483647

the "error_log" file says:
[Tue May 30 22:19:44.533866 2023] [cgid:error] [pid 22217:tid 139805337741056] [client 151.21.204.48:59042] End of script output before headers: test.cgi

What can I do to activate cgi-bins?
Thanks for the attention
Best regards

Link to comment
Share on other sites

as i wrote, the error_log says:

[Tue May 30 22:19:44.533866 2023] [cgid:error] [pid 22217:tid 139805337741056] [client 151.21.204.48:59042] End of script output before headers: test.cgi

 

the "test.cgi" file works on my machine: Linux/Devuan + Apache2

Link to comment
Share on other sites

Krydos will need to look at this as I don't see any reason this shouldn't work (looking at the Perl script, not sure if the C++ one is supported or not).

It has 755, shebang line looks correct, it has a header and unix line endings, in cgi-bin folder, tried renaming the .htaccess...all give the same error. 

Link to comment
Share on other sites

I created a copy called test2.pl and that doesn't work either (difference in that is the shebang line). I'm not too familiar with CGI though, so I'm probably missing something that'll be obvious as soon as its pointed out...

Link to comment
Share on other sites

I compiled test.cgi (c++) on my system: Linux/Devuan amd64

I also wanted to try with a perl script, but it doesn't work.

I set the rights to 755 and wrote the .htaccess file, which didn't exist.

In my system everything works fine

thank you all for your attention, you are very kind

Link to comment
Share on other sites

26 minutes ago, z0n1n0z said:

I compiled test.cgi (c++) on my system: Linux/Devuan amd64

C++ executables generally have to be compiled on the system that they are intended to run on. It is technically possible to build a CentOS 7 system on your home PC running Plesk and all the rest of our software with the same paths as we use, but that's going to be very difficult if not impossible to get correct. Therefore if you want to have any remote possibility of a  C/C++ executable actually working you're going to need to compile it on Tommy. You can accomplish this via cronjob, but make sure you delete your cronjob after it runs once otherwise it's possible it could continue compiling it over and over until you get suspended.

33 minutes ago, z0n1n0z said:

I also wanted to try with a perl script, but it doesn't work.

I set the rights to 755 and wrote the .htaccess file, which didn't exist.

The reason perl wasn't working is because you changed the permissions of cgi-bin for some reason. It all works fine when I changed it back to 755 like it was when your account was created. https://z0n1n0z.helioho.st/cgi-bin/test.pl

34 minutes ago, z0n1n0z said:

In my system everything works fine

Like I already touched upon, this is only a valid argument if you're running CentOS 7 with Plesk and everything else set up exactly the same we have it.

Link to comment
Share on other sites

  • Krydos changed the title to [Solved] cgi-bins don't work

unfortunately there is another problem: I can't compile it because the compiler is missing. I noticed that a system now appears to be available in the home, but the files in /bin/ and /usr/bin/ are the same. In any case, for example, g++ is missing

Link to comment
Share on other sites

Not yet: as I already said, in fact

Quote

the files in /bin/ and /usr/bin/ are the same

 

which means that

/usr/bin/gcc

also doesn't exist, like all the files that should be in `/usr/bin/`, because instead of `/usr/bin/` I still have `/bin/`

you probably thought I hadn't checked yet and thought everything was fine...

 

Link to comment
Share on other sites

  • z0n1n0z changed the title to cgi-bins don't work

Not sure why you think it doesn't exist

root@tommy2 [~]# /usr/bin/gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 

Link to comment
Share on other sites

`/usr/bin/gcc` does not exist "for me", because it is not accessible to me: I cannot access the `/usr/bin/` directory. If in Plesk I click on `/usr/bin/` then I see `/bin/`. I don't have the ability to use `/usr/bin/gcc`

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...