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

Postby owen » Aug 19, 2019 14:00

Thank you Julcar I tried your idea and same results.

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

Re: Is it possible to Hello world on a server

Postby MrSwiss » Aug 19, 2019 14:05

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

Postby owen » Aug 19, 2019 14:07

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

Re: Is it possible to Hello world on a server

Postby MrSwiss » Aug 19, 2019 14:16

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: 82
Joined: Oct 19, 2010 18:52
Contact:

Re: Is it possible to Hello world on a server

Postby Julcar » Aug 19, 2019 19:35

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

Postby owen » Aug 20, 2019 1:18

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

Postby owen » Aug 23, 2019 4:24

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

Re: Is it possible to Hello world on a server

Postby owen » Aug 23, 2019 5:55

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

Re: Is it possible to Hello world on a server

Postby Julcar » Aug 23, 2019 9:37

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

Postby owen » Aug 24, 2019 4:15

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

Postby owen » Aug 24, 2019 4:19

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

Postby owen » Aug 24, 2019 4:24

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

Postby owen » Aug 24, 2019 5:46

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

Re: Is it possible to Hello world on a server

Postby owen » Aug 24, 2019 10:44

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

Postby owen » Aug 24, 2019 16:58

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.

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 3 guests