Is it possible to Hello world on a server

Linux specific questions.
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Thank you Julcar I tried your idea and same results.

Has anyone tried to do this before with any success?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is it possible to Hello world on a server

Post by MrSwiss »

owen,

what sort of FTP-client are you using to upload and chmod?
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Filezila.
I chmod the binary to 755
Also when I upload the binary I upload it using binary transfer type
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Is it possible to Hello world on a server

Post by MrSwiss »

7 = all rights
can't remember the other (numerical) details ... except ordering:
user -- group -- world
I think that world needs: read/execute (nothing else)
Reason user is usually: "anonymous" (the user with a browser, accessing web-server)
Julcar
Posts: 141
Joined: Oct 19, 2010 18:52
Contact:

Re: Is it possible to Hello world on a server

Post by Julcar »

owen wrote:Thank you Julcar I tried your idea and same results.

Has anyone tried to do this before with any success?
Errata, I just remember that my code needs an empty PRINT in the second line, just after sending the content type and before the first html tag

Code: Select all

PRINT ""
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Why would that matter? Maybe. It' a cgi thing.. Any how I will give it a try.
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Eureka
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Next test...
Try to compile on a vps
...
I get segmentation fault core dumped just running fbc
Julcar
Posts: 141
Joined: Oct 19, 2010 18:52
Contact:

Re: Is it possible to Hello world on a server

Post by Julcar »

owen wrote:Eureka
what just happened?
did the binary cgi run on your shared hosting?
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Well I couldn't get it to work on shared hosting. So I got a vps
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

Oh and I'm not using cgi. The binary is in the same folder as the php and source code
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

That binary was compiled using centos on my laptop. Next I will try to compile it using ubuntu and see if it runs on the server
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

check it out http://fbcadcam.org/fbs/fbs.php

fbs.php

Code: Select all

<?php
$output = shell_exec("./fbs");
echo "<pre>$output</pre>";
?>
calls (runs) fbs
which interprets / runs test.bas

test.bas

Code: Select all

dim as integer i
for i = 1 to 10
print i
print "this is a test of fbs"
next
owen
Posts: 555
Joined: Apr 19, 2006 10:55
Location: Kissimmee, FL
Contact:

Re: Is it possible to Hello world on a server

Post by owen »

My goal was to figure out how to Hello world on a server in linux so that i could ultimately do some fun stuff like fbs.
Thanks to the FB community for helping me along my adventure.

To know more about my fbs, links to the project are at https://www.fbcadcam.net/forum/viewforum.php?f=19

In summary:

I finally learned how to install freeBASIC on linux and compile my simple programs ie. programs not using any libraries. I hope to learn more about this using some of the libraries.
The instructions provided in the freeBASIC linux distribution readme.txt file work. For me all I really needed to do was simply read them and do as they suggest. The harder part for me was learning how to use linux itself and how to deal with multi boot stuff and linux server stuff.
What a joy it is to finally be able to use the freeBASIC compiler on linux.

Regarding the question: Does it matter which linux distro / flavor is use to compile my source_code.bas with fbc and ultimately run it on centos (ie bluehost's servers) is NO, it did not matter. I was able to compile and run my binary regardless if my os was ubuntu or centos on my laptop. Also i imagine it Does Not Matter in the case you you just want your binary to run on a linux desktop. I would answer this question myself by way of further testing specially with the likes of DSL (oh boy DSL looks awesome, not so small now). But I'll save that for another time.
Post Reply