z0n1n0z Posted May 30, 2023 Posted May 30, 2023 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
Unknown025 Posted May 31, 2023 Posted May 31, 2023 Have you tried checking the error log? You can find it in Plesk's dashboard.
z0n1n0z Posted May 31, 2023 Author Posted May 31, 2023 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
wolstech Posted May 31, 2023 Posted May 31, 2023 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.
wolstech Posted May 31, 2023 Posted May 31, 2023 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...
Krydos Posted May 31, 2023 Posted May 31, 2023 Did you compile the C++ executable on Tommy, or on some other system?
z0n1n0z Posted May 31, 2023 Author Posted May 31, 2023 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
Krydos Posted May 31, 2023 Posted May 31, 2023 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.
z0n1n0z Posted May 31, 2023 Author Posted May 31, 2023 I didn't know about the cronjob: I guess it's under "scheduled tasks". Now I try thank you very much
z0n1n0z Posted May 31, 2023 Author Posted May 31, 2023 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
z0n1n0z Posted June 1, 2023 Author Posted June 1, 2023 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...
Krydos Posted June 3, 2023 Posted June 3, 2023 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.
z0n1n0z Posted June 3, 2023 Author Posted June 3, 2023 `/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`
Recommended Posts