Search the Community
Showing results for tags 'cgi'.
-
I saw a couple of questions regarding Rust on HelioHost. While it isn't officially supported, I did manage to get a simple Rust application running on Tommy! My method was based on the fact that you can upload Go binaries and run them according to this tutorial. Since a binary is a binary, why not deploy a Rust one the same way? The simple method: At its most basic level, a CGI script just has to return text along with headers. Consider the "Hello world" Perl script: #!/usr/bin/perl print "Content-Type: text/html\n\n"; print "Hello World!"; Based on this, I made the following Rust script, mini.rs: fn main () { print!("Content-type: text/html\n\n"); print!("Hello world!"); } Interlude: Experimentation (you can skip this italicised section unless you want the details) At first, I tried compiling this with a simple rustc mini.rs and uploading the resulting mini file to my cgi-bin. (I use Manjaro, which is Linux, so since HelioHost also uses Linux I didn't have to change the target architecture). However, that was resulting in a 500 Internal Server Error. To debug this, I tried running the compiled binary on a different VPS (running Debian, so it would have slightly older versions of libraries than Manjaro). I realised that the library glibc/libc6 wasn't matching. I found a related comment on this StackOverflow question suggesting using static linking as described in this other StackOverflow answer. I already had the dependencies, so all I had to do was add extra arguments to the compile process to make it: rustc -C target-feature=+crt-static mini.rs. This produced a statically linked binary which I could then run anywhere! To deploy the program to HelioHost, all I had to do was: Run the command to create a statically linked binary, rustc -C target-feature=+crt-static mini.rs (if you're not using Linux you'll have to also set up and specify the Linux architecture as a build target) Copy the resulting mini binary file (the one without the .rs extension) to my website's cgi-bin Set the permissions to 755 (rwxr-xr-x, in other words everyone has read and execute permissions and only the owner has write permissions) Navigate to my website's /cgi-bin/mini and the page rendered! I think a binary may not be necessary if you can compile using the same version of libc6 that's running on Tommy (assuming it has the libc6 library at all) The advanced method: Instead of returning plaintext, you can also use a library like rust-cgi to generate the output for you. I'm not sure how exactly it works since I'm not familiar with CGI but I'm guessing it will help do things like read header data? I followed the docs there to create an empty Cargo project and the following main.rs file: extern crate cgi; cgi::cgi_main! { |_request: cgi::Request| -> cgi::Response { cgi::html_response(200, "<html><title>My Site</title><body>Hello world!</body></html>") } } After this I ran cargo build with the modified flags to get a statically linked binary: RUSTFLAGS="-C target-feature=+crt-static" cargo build Basically, setting the RUSTFLAGS environment variable before running Cargo. If you're doing this often, you can also add the option to Cargo.toml: [build] rustflags = ["-C", "target-feature=+crt-static"] target = "x86_64-unknown-linux-gnu" ...and then simply run cargo build to get the binary. This created a larger binary than with the simple method; mine was around 8.1MB instead of 5.4MB. This is presumably because it has more features (that we aren't using right now) bundled from the library. But if you are using those features I'm guessing it'll be helpful. Uploading the resulting binary, target/debug/[your project name], to cgi-bin will make it get auto-executed whenever you load that URL. WARNING: MAKE SURE YOUR PROCESS ENDS! Most Rust web frameworks like axum, Actix, and Rocket fire up a permanently running web server listening on a given port. That will use up your CPU resources and probably push you over your limit—or, best case, cause your process to get killed after some timeout. Either way, it won't work! So make sure your process runs quickly, prints whatever it needs to, and then exits. It will repeat this for every request, just like the scripts for Perl, PHP, and other languages do. Unfortunately that means we can't use most Rust web frameworks, unless we figure out a way to make them work the CGI way (if you figure that out, please let me know!). Tip: Local testing To test your CGI scripts locally, you can go into any folder, create a folder named cgi-bin inside, and run the following command in the outer folder (i.e. not inside cgi-bin) python -m http.server --cgi This will fire up a local server (usually at localhost:8000), and anything you put in the cgi-bin folder (including Rust binaries) will execute the same way they would on an actual server.
-
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
-
Greeting, This a newpie here, I got a problem (500 error) with the server caused by this code new_message = "<p dir=\"rtl\" lang=\"ar\" style=\"color:#e0e0e0;font-size:20px;\">رَبٍّ زِدْنٍي عِلمًا</p>" it works with my python shell, but not on the server, is the server cgi files can't take a foreign language? or is it my code? I'm not sure what to do to fix this. Please help me out! Thank you so much!! I appreciate your hard work UPDATE: FIXED! Thank you a lot UPDATE: FIXED! Thank you a lot
-
Hello there! I have set up an account today to host 2 python bots, and I tried starting them. But when I go to cgi-bin, I get a 403 error. I can view https://alpriven.heliohost.org , and the cPanel. I have checked the permissions and they are 755 (both for cgi-bin and the files). Am I doing something wrong? How can it be that cgi-bin's permissions are 755 and yet I can't access it. Thanks for any help!
-
First of all, thanks for the service. I'd like to use common lisp as cgi. There is no hosting in the world with that feature. I guess it won't cost so much to add an interpreter for common lisp. The best choice is sbcl, which sure has a binary for linux. And the second one is clisp. Lisp is a very special language and could be an interesting feature to have and call more possible members. I guess it's easy to add it as cgi, since it only needs an interpreter, and sbcl is very available and easy to install. Also common lisp is a very mature language, and sbcl the best implementation. If you consider it, could be a nice feature to add, and can create some interest for a lot of users. Ofc If you add common lisp, specially sbcl I'll say to all lispers that you've added a lisp cgi for that host. And they could even be donators. Thanks for your time.
-
Hey guys, I'll cut to the chase. How do I kill all running cgi scripts in my instance? I'm rdfnr on Johnny. I am learning to make some python scripts (chat bots) but they keep running and I don't know how to kill the processes without a terminal. Thanks in advance. Things I wanted to say: incredible service, thanks to everyone involved. This is great for people like me, to learn and get experience.I'll at least build in a termination option into the scripts I'm trying to run in the future... I guessI did use the search function and scrolled through some pages before posting. Sorry if this has been answered before. Best regards rdfnr
-
I try to write an easy basic CGI in python and get this Internal server error 500. What am I doing wrong? user/script theil.heliohost.org/cgi-bin/hello-get.py on johnny just a "Hello World" #!/usr/bin/python[LF] print("Content-Type: text/html\n\n")[LF] print("Hello")[LF] + The [LF] are the right line endings with notepad++. + I changed the permissions on Windows to everyone. Why can´t it just work... Thanks in advance! Andy
-
Hi, this is the first time I write, I hope not to write in the wrong section. My problem is the following: I uploaded a project in PERL - XSLT - XML, but something does not work and I do not understand what, and I do not know how to find out the reason. I have configured .cgi files with shebang line " #!/usr/bin/perl -w " first and " #!/usr/bin/perl " after, and set permissions 0755. Hello World works perfectly. http://www.pandora.heliohost.org/cgi-bin/prova.cgi However when I run the project i get 500 error. http://www.pandora.heliohost.org/cgi-bin/home.cgi Is there a way to have more detailed information on what does not work so I can understand where the error is?
-
Sorry, I really tried to find the solution in the forum: I got a perl script in the cgi-bin folder of my public_html. Permission is 0755 (so runable) in File Manager. Shebang is #!/usr/bin/perl -w But when i try "http://tarock.heliohost.org/cgi-bin/test.pl" I get the Internal Server Error. :-( test.pl: #!/usr/bin/perl -w use strict; use CGI; print "Content-type: text/html\n\n"; print "Hello World\n"; Server: Stevie User: tarock
-
I uploaded my cgi script to scgi-bin in public_html folder, but when i want to access it via url it return error like this scgiwrap: Caller must be the nobody user I also tried to upload in cgi-bin folder, but instead error above i got 500 internal server error is there any solution? Thank you
-
Am stuck trung to diagnose what is wrong with my perl CGI. A simpel port from a previous host, so I try say a simple Perl script that prints a list of variables: http://bernd.wechner...bin/printenv.pl and the error I receive is: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@bernd.wechner.info and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.24 (Unix) mod_ssl/2.2.24 OpenSSL/0.9.8e-fips-rhel5 mod_mono/2.6.3 mod_jk/1.2.35 FrontPage/5.0.2.2635 mod_bwlimited/1.4 mod_auth_passthrough/2.1 mod_wsgi/3.4 Python/2.7.4 Server at bernd.wechner.info Port 80 And yet in my error log I see only a failed access attempt to: [Tue May 12 14:30:16 2015] [error] [client 122.151.20.175] File does not exist: /home/bwechner/public_html/bernd/500.shtml which makes sense as Ithe reported error says as much. Now the script has mode 0755 as needed and it resides in the cgi-bin fold which laso has 0755 mode. The access log correctly shows: 122.151.20.175 - - [12/May/2015:14:30:16 -0700] "GET /cgi-bin/printenv.pl HTTP/1.1" 404 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0" And the favicon displays on my browser tab. Is there a way to further diagnose why a very simple perl CGI would throw a 500 error? Here's all it contains: #!/usr/bin/perl print "Content-type: text/html\n\n"; foreach $key (keys %ENV) { print "<li>$key: $ENV{$key}"; } Any help would be deeply appreciated.
-
Looking for help with CGI files. I try to include one on my website but it gives an error and sometimes it doesnt show anything. I'am on the Johnny host what i got to do. <!--#include virtual="/cgi-bin/poll.cgi?poll=1" --> actually that is my include for the poll The script contains the following #!usr/bin/perl print "content-type: text/html\n\n" use strict; use CGI qw(:all); my $poll_id = int(param('poll')); my $action; open FH, "poll_${poll_id}_ip.txt"; my $ip = <FH>; close FH; chomp $ip; $ip = defined($ip) ? $ip : ''; if ($ip eq '') { $ip = ':' } my $pat = join('\.', split(/\./, $ENV{'REMOTE_ADDR'})); my $mode = $ip =~ /\:$pat\:/ ? 0 : 1; if (($mode == 0) || defined(param('see'))) { print "Content-Type: text/html\n\n"; print "<center>Poll results</center>\n"; open FH, "poll_${poll_id}_text.txt"; my @lines = <FH>; close FH; print join("<br>", @lines); open FH, "poll_${poll_id}_lines.txt"; my @lines = <FH>; close FH; open FH, "poll_${poll_id}_results.txt"; my @votes = <FH>; close FH; my $sum = 0; foreach (@votes) { $sum += int($_); } print "<center><table border=0 cellspacing=0 cellpadding=4>"; for (my $i = 0; $i <= $#lines; $i++) { my $width = 200; my $a = int($votes[$i] * $width / $sum); my $b = $width - $a; print "<tr><td align=right>$lines[$i] (".int($votes[$i]).")</td><td><table width=$width height=10><tr><td width=$a bgcolor=black></td><td width=$b bgcoloe=blue></td></tr></table></td></tr>"; } print "</table></center>"; } else { if (defined(param('dovote'))) { my $vote = int(param('vote')); open FH, "poll_${poll_id}_lines.txt"; my @lines = <FH>; close FH; if ($vote > $#lines) { print "Content-Type: text/html\n\nError"; exit 0; } open FH, "poll_${poll_id}_results.txt"; my @lines = <FH>; close FH; foreach (@lines) { chomp $_; } $lines[$vote] = int($lines[$vote]) + 1; open FH, ">poll_${poll_id}_results.txt"; print FH join("\n", @lines); close FH; open FH, ">poll_${poll_id}_ip.txt"; print FH "$ip$ENV{'REMOTE_ADDR'}:"; close FH; print redirect(-uri => $ENV{'HTTP_REFERER'}); } else { print "Content-Type: text/html\n\n"; print "<form action=/cgi-bin/poll.cgi method=post>"; print "<input type=hidden name=poll value=$poll_id>"; open FH, "poll_${poll_id}_text.txt"; my @lines = <FH>; close FH; print join("<br>", @lines); print "<center><table border=0 cellspacing=0 cellpadding=4>"; open FH, "poll_${poll_id}_lines.txt"; my @lines = <FH>; close FH; for (my $i = 0; $i <= $#lines; $i++) { print "<tr><td align=center><input type=radio name=vote value=$i></td><td>$lines[$i]</td></tr>"; } print "<tr><td align=center colspan=2><input type=submit name=dovote value=Vote> <input type=submit name=see value=\"See results\"></td></tr>"; print "</table></center>"; print "</form>"; } } my error log says [Tue Feb 28 11:03:07 2012] [error] [client 92.66.136.41] unable to include "cgi-bin/poll.cgi?poll=1" in parsed file /home/jeroenn/public_html/Home.shtml please help me on the page it is showing [an error occurred while processing this directive]
-
So I'm new to HelioHost and created a domain not long ago. I uploaded my own web page in a html file which works perfectly, but I also want to be able to execute a python script with cgi from it. I tried executing my Python script from the html page in my own local server and it works fine, but when I upload both the html and my python script (the latest on the cgi-bin folder) it doesn't work. The code in the html is the next : <form action="/cgi-bin/script.py" method"GET"> <fieldset> <br>First seiyuu:<br> <input type="text" name="name"> <br>Second seiyuu:<br> <input type="text" name="name"> <br><input type="submit" value="Submit"><br> </fieldset> </form> Pretty much I just execute my 'script.py' when you click the submit button. And this is the code for my python script: script.py #!/usr/local/bin/python print "Content-type: text/html" print print "<html>" print '<body>' print '<p> Hello World</p>' print "</body>" print "</html>" When I click the submit button on my html page, I just get an Error 500. My index.html and all the files in the cgi-bin (including the folder itself) have the permissions set to 755 (All can be full executable). Does anyone have any idea on what might be causing the error? Thanks in advance
-
Hi all, I am trying to write my first CGI script using Python on my shared virtual web server. I put the script under 'public_html' in the 'cgi-bin' folder on my web server. I made the script executable with the chmod +x command. For the she-bang I am using #! /usr/bin/env python so that the script will be able to find any Python interpreter and not a specific one at a specific location. I made a test form to call the script from when a button is clicked but I just receive a 500 Internal Server error when trying to run this script. I messed around some with the location of the cgi script, which is a .py file in this case, but only received 404 errors. Does anyone reading this know what I am missing? Here is my Python script: #! /usr/bin/env python print "Content-type:text/html\r\n\r\n" print '<html>' print '<head>' print '<title>Hello Word - First CGI Program</title>' print '</head>' print '<body>' print '<h2>Hello Word! This is my third or fourth or so CGI program</h2>' print '</body>' print '</html>' Here is my HTML code that calls the Python script: <!DOCTYPE html> <head> <title>Test CGI Scripting With Python</title> </head> <body> <center> <form action="cgi-bin/hello.py" method="post"> Click this button <input type="submit" value="Submit" /> </form> </center> </body> </html> Thank-you for reading this everybody. Respectfully, minus
-
Hi my username for heliohost is pianist1119 and my domain is pianist1119.me. When i try to test my cgi script by inputing "pianist1119.me/cgi-bin/basic.cgi" into my web browser i get an internal server error. Any help would be greatly appreciated and thanks in advance
-
Hi everybody, I am quite excited to be starting my first website with heliohost, and am happy to join this community. My first challenge: I have a python cgi script, that calls a module, the files for which are placed in the same folder as the python cgi script. the folder is placed as a sub folder under the cgi-bin folder. I have placed the python shebang line(#!/usr/bin/python), the content type (print("Content-type: image/png\n")), and made the entire subfolder and its contents chmod permission 755. the code in my file is as follows: #!/usr/bin/python from pychartdir import * # The data for the bar chart data = [85, 156, 179.5, 211, 123] # The labels for the bar chart labels = ["Mon", "Tue", "Wed", "Thu", "Fri"] # Create a XYChart object of size 250 x 250 pixels c = XYChart(250, 250) # Set the plotarea at (30, 20) and of size 200 x 200 pixels c.setPlotArea(30, 20, 200, 200) # Add a bar chart layer using the given data c.addBarLayer(data) # Set the labels on the x axis. c.xAxis().setLabels(labels) # Output the chart print("Content-type: image/png\n") binaryPrint(c.makeChart2(PNG)) I placed all the files for the pychartdir module in the same folder. but it still doesnt work. the link is here: http://promtech.heliohost.org/ . (its the 3rd broken link) I would appreciate very much if anyone here can point out something I have been missing. I have tried to find the answers on these forums and google, but have come up with nothing that works. Many thanks in advance! John
-
Hi everyone! i have a Problem with a Perl/Ruby CGI Script - 500 Internal Server Error. user: dagger address: http://dagger.heliohost.org Server: Johnny From the very beginning Perl was not worked: http://dagger.helioh...cgi-bin/test.pl #!/usr/bin/perl BEGIN { my $b__dir = (-d '/home/dagger/perl'?'/home/dagger/perl':(/>/> getpwuid($>) )[7].'/perl'); unshift @INC,$b__dir.'5/lib/perl5',$b__dir.'5/lib/perl5/x86_64-linux',map { $b__dir . $_ } @INC; } print "Content-type: text/html\n\n"; print <<HTML; <html> <head> <title>A Simple Perl CGI</title> </head> <body> <h1>A Simple Perl CGI</h1> <p>$theTime</p> </body> HTML Ruby was for beginning worked, but now the same problem - 500 Internal Server Error http://dagger.helioh...gi-bin/test.cgi #!/usr/local/bin/ruby -w require 'cgi' cgi = CGI.new puts cgi.header puts "<html><body>This is a test</body></html>" http://dagger.helioh...in/test_ruby.rb #!/usr/bin/ruby puts "Content-type: text/html" puts puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" puts "<!DOCTYPE html>" puts "<html>" puts "<head>" puts "<title>Ruby CGI test</title>" puts "</head>" puts "<body>" puts "<p>Hello, world!</p>" puts "<br> puts "Ruby is amazing! :)/>/>" puts "</body>" puts "</html>" My question is, what happened with Perl and Ruby? Python and Free Pascal CGI working fine Thanks in advance! P.S. Sorry, for my pure English
-
Hello, Everyone. I'm having problems with my CGI executable on my site. It gives HTTP 500 Internal Server Error while I have no access to any detailed logs to be able to troubleshoot the problem. It works well on my computer. The permissions of the file are set correctly (755). And another "Hello, World!" CGI program works perfectly on the server. It seems to me that this is a linking issue. Here are the details of the executable: The executable is linked with the following libraries: Source Code: #include <iostream> #include <mysql.h> using namespace std; const string CRLF = "\r\n"; int main() { cout << "Content-Type: text/plain" << CRLF << CRLF; cout << "Hello, World!" << CRLF; try { cout << "MySQL Client Version: " << mysql_get_client_info() << CRLF; } catch(exception& ex) { cout << "ERROR: " << ex.what() << CRLF; } return 0; } Compiled Using: gcc 4.7 with the following specifications: Makefile: #Variables: INCLUDE_DIR = -I/usr/local/mysql/include LIBS_DIR = -L/usr/local/lib64 STATIC_LIBS = -lmysqlclient DYNAMIC_LIBS = -ldl -lpthread -lrt STATIC_LINK_FLAG = -Wl,-Bstatic DYNAMIC_LINK_FLAG = -Wl,-Bdynamic LD_FLAGS = $(LIBS_DIR) $(STATIC_LINK_FLAG) $(STATIC_LIBS) $(DYNAMIC_LINK_FLAG) $(DYNAMIC_LIBS) #Rules: test.cgi: test.cpp g++ test.cpp $(INCLUDE_DIR) $(LD_FLAGS) -o test.cgi
-
Hi all. I've recently got a free account from Heliosoft. Now, i'm unable to run even a simple cgi. Is cgi active by default? I've put a simple demo.cgi in cgi-bin with following code: #!/usr/bin/perl print "Content-type: text/html\n\n"; print <<HTML; <html> <head> <title>A Simple Perl CGI</title> </head> <body> <h1>A Simple Perl CGI</h1> <p>Hello World</p> </body> HTML exit; Then, i've changed file permission to 755 (even 777) but i get following error all times: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@gistech.heliohost.org and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Any idea of what's wrong here? Thanks in advance.
-
DELETED
-
Hello Forum's people, I am using Stevie Server. I am using PHP pages. I also have scripts in PERL The site worked fine but one day it didn't work any more. I don't know what happens. Normal pages in .html work fine, but none of .php or .cgi pages work anymore. Even if I test the "hello world" script: <? print("Hello World"); ?> It don't works. Always appear "Internal Server Error" Perhaps I unintentionally change something. Could somebody help me? EDIT: There were 5 unkilled .cgi processes running since July 17.