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 18, 2019 0:35

is there some what to include these in the hello binary

inux-gate.so.1 (0xf7fa7000)
libtinfo.so.5 => /lib32/libtinfo.so.5 (0xf7f67000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7e65000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7e60000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7e41000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7c65000)
/lib/ld-linux.so.2 (0xf7fa9000)
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 18, 2019 0:39

or better yet...
maybe i can install the same server linux flavor bluehost is using on my laptop (how to do that i don't know yet) and then install fb and compile and 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 18, 2019 0:43

quick search says
BlueHost has CentOS with SSH access and cPanel for its shared, dedicated, and VPS Linux servers. The web server is a customized version of Apache.

so i will try to install CentOS i guess
speedfixer
Posts: 468
Joined: Nov 28, 2012 1:27
Location: California

Re: Is it possible to Hello world on a server

Postby speedfixer » Aug 18, 2019 1:23

What is the goal?

When you say 'server' I assume that you mean your web host server, correct?
Unless you have someone really friendly, they shouldn't be allowing someone to upload any old executable into their server.

Think about it: while FB wouldn't be called a bare-metal language, it isn't far from it, and not hard to trick up some slick assembly with it. What they usually provide are some particular services that assist web services. Particular languages and scripting execution that they can sandbox and virtualize pretty securely.

Can you tell that the FB code even executes on the server? Could you index the directory and see if a new file resulted?
You CAN specify all static linking when you compile the executable, but it might be a bit larger than you think. Probably won't work, though, becuase you probably don't have static versions of all the libraries FB needs. And may still clash with your server. But it SHOULD be denied by the server.

Or ... let me give you a compiled program to upload to have his server bitcoin mine for me. :)

Was the question you asked your provider about the script, or the program execution?

david
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 18, 2019 2:11

i plan (hope) to compile fbcadcam-macro and run it (use it) as a server side scripting language for my own personal use.
maybe better to say it like this...
you got ASP and PHP and soon FBS
Knatterton
Posts: 165
Joined: Apr 19, 2019 19:03

Re: Is it possible to Hello world on a server

Postby Knatterton » Aug 18, 2019 6:24

owen wrote:note:
$output = shell_exec('ls -lart');
doesn't require ./
ie.
$output = shell_exec('./ls -lart');

i wonder what language ls was written / compiled in

I was assuming this exec will execute a commandline like with the pure OS, where in linux "ls" is on the path and not need "./" while a program in another directory needs a "./" to execute,

If your output is "hello" this seems to be the filename or you have another version of fb, because my version 1.06 84 bit prints out "Hello from FreeBASIC!"

hello.bas:

Code: Select all

print "Hello from FreeBASIC!"

print "Press any key to continue..."
sleep


The programs in /bin are written in pure C afaik. So in my experience, where they work simple console programs work, too. But mostly i not use exotic linux versions, Common versions like mint make many things much easier. :-)

This does not mean i would doubt anything that speedfixer has written.

Edit: Just seen, you have written your own "hello.bas", but that changes the meaning not completely.
Last edited by Knatterton on Aug 18, 2019 6:38, edited 1 time in total.
speedfixer
Posts: 468
Joined: Nov 28, 2012 1:27
Location: California

Re: Is it possible to Hello world on a server

Postby speedfixer » Aug 18, 2019 6:30

The programs in /bin or at any other executable directory could be written in anything. Many are no more than bash or dash scripts.

The question still remains:

Are you trying to execute on your third party remote hosted WEB server?
What are you ALLOWED to run?

david
Julcar
Posts: 82
Joined: Oct 19, 2010 18:52
Contact:

Re: Is it possible to Hello world on a server

Postby Julcar » Aug 18, 2019 10:05

I would try first running a pure CGI written in FB, here in the forum I posted some examples, if the cgi runs then you could try further
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 18, 2019 16:38

Are you trying to execute on your third party remote hosted WEB server?



Yes, I reckon that's what I'm trying to do and yes I think bluehost will let me do so.

pure CGI written in FB


I never knew what CGI was but now that you say this I will definitely be looking into it


At the moment I am struggling with grub and grub2 trying to accomplish a triple boot. It's really kicking my butt.
Knatterton
Posts: 165
Joined: Apr 19, 2019 19:03

Re: Is it possible to Hello world on a server

Postby Knatterton » Aug 18, 2019 17:57

owen wrote:At the moment I am struggling with grub and grub2 trying to accomplish a triple boot. It's really kicking my butt.

Forget it. A good distro should do this automatically, as long you have each OS on a own partition. You can google before if your distros do this.
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 2:40

I compiled and ran hello world on centos.
I then upload it to the server and tested it with the same results. At least this narrows down the possibility of why it's not working.

I think the real answer is that blue host or shared hosting plans do not allow running custom software. In order to do something like this I would have to go with a VPS or dedicated server plan.
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 8:23

owen wrote:I compiled and ran hello world on centos.
I then upload it to the server and tested it with the same results. At least this narrows down the possibility of why it's not working.

I think the real answer is that blue host or shared hosting plans do not allow running custom software. In order to do something like this I would have to go with a VPS or dedicated server plan.


I think you're doing it in the wrong way, because binary cgi was quite popular in the Apache beginnings, before Perl and PHP enters in the scene, and in some way, modern webhosts using apache has been inheriting those settings over the time.

Remember that the user running a shell from php perhaps is not the same as running a executable from apache, permissions issues.

try the following code:

Code: Select all

PRINT "Content-type: text/html;charset: us-ascii"
PRINT "<html>"
PRINT "<head>"
PRINT "<title>Hello World</title>"
PRINT "</head>"
PRINT "<body>"
PRINT "<h1>Hello, World!</h1>"
PRINT "<p>"
PRINT "</p>"
PRINT "</body>"
PRINT "</html>"
SYSTEM


Compile it and upload it to your /public_html/cgi-bin folder, chmod +x, and try to run
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 9:47

What does the +x mean in chmod +x
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 12:27

owen wrote:What does the +x mean in chmod +x
chmod (in 'ix systems, is: access control change) and: +x (means: add execute rights)
The same as: attr (command, in WIN/DOS)
This is OS stuff ... (nothing to do with programming itself)
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 13:40

Thanks Mr. Swiss

Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests