Solved

¿How to run program library from a webpage(php)?

Posted on 2016-09-20
7
22 Views
Last Modified: 2016-09-30
Hi

I would like to know ¿if it is possible to run fortran compiled libraries in a webpage?

Today I made a "fortran compiled library" (ddl) and a local program that send info to the fortran ddl file to process something and return data to the local program to present the info.

But when I present the project my boss request me to do the same but in a webpage and for real I had to much clue about what I need to do.

1.- In my job we had a dedicated server with linux as a OS and I presume that i need to install a fortran version, but what version should be better.


2.- In this case i assume that I need to do a php form with some input box to collect info and send it by get or post to a fortran compiled library and return the result to another php page.
     
     - As you know in windows you can do a ddl compiled files to add them to a program and do "things", my question  will be in linux can i do somekind a compiled library (like dll in windows) to call the compiled fortran module from the php page or there is another way to do this.

Sorry if this question are a little dump but im really newbie on linux.

Best regards.
0
Comment
Question by:altariamx2003
  • 3
  • 2
  • 2
7 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 41808100
On a web page in your browser, you are not normally allowed to directly run programs like that.  Sometimes you can set up a program to run as a 'CGI' program thru the web server and browser but that requires the program to be set up to do that and return the correct header info for a web page.  This is true on both Windows and Linux.
0
 
LVL 9

Expert Comment

by:Brian Tao
ID: 41808137
It doesn't sound like a good idea.  A better way (as I'm a PHP'er) is to rewrite the feature using PHP since you're going to write a PHP form trying to use that Fortran ddl.
But if there's no other choice, the idea will be the following:
  1. modify the local program to accept command line parameters for whatever you want to send to the ddl
  2. modify the local program so that it output what you "present the info" as text strings
  3. in your php script, use the function exec() to run the program, get the output and present it on the webpage
The definition of exec() function:
// definition:
// string exec ( string $command [, array &$output [, int &$return_var ]] )

Open in new window

0
 

Author Comment

by:altariamx2003
ID: 41808817
Hi guys

First of all thx a lot to take the time to answer my post, you guys are awesome.


At this moment I have access to the linux server (dedicated server), so that is  not a problem.

I know that ddl files are from windows, bcause im not so good on linux i was asking about what is the alternative to ddl's on linux, bcause i know that thouse files usually only works on windows.

What kind of files do i need to compile to use it in my linux server to do the same in linux???

with the exec function in php could I run a fortran code in my server linux??
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 250 total points
ID: 41808873
'*.so' (for shared object) is the basic equivalent to Windows DLLs.  However, as Brian described above, it is not that simple.  Your program must be written to show the appropriate data to the web server.  This is not the same as just showing it on the screen.
0
 
LVL 9

Assisted Solution

by:Brian Tao
Brian Tao earned 250 total points
ID: 41808918
What kind of files do i need to compile to use it in my linux server to do the same in linux???
I don't know Fortran, but I know that on a Linux machine, the similar thing to Windows DLL (dynamic link library) is .so file (Shared Object).  As of how........... sorry that I cannot help.

with the exec function in php could I run a fortran code in my server linux??
With the exec() function you can call any linux commands or programs.  For example,
exec('ls', $output, $return_var);

Open in new window

will run "ls" (like "dir" in Windows), return the result (the list of files and folders) into $output (an array of strings), and the returned status in $return_var.

So let's say you run your local program (from command-line) like this: local_program para1 para2, then your PHP statement will be
exec('local_program para1 para2', $output, $return_var);

Open in new window

0
 

Accepted Solution

by:
altariamx2003 earned 0 total points
ID: 41814851
sorry guys i was with some troubles, thx for your time guys.

I gonna keep looking for the answer in other forums
0
 

Author Closing Comment

by:altariamx2003
ID: 41823168
i gonna close the question bcause i was looking for someone that knows something about fortran

thx anyway
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now