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

Posted on 2016-09-20
Last Modified: 2016-09-30

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.
Question by:altariamx2003
  • 3
  • 2
  • 2
LVL 83

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.

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


Author Comment

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??
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

LVL 83

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.

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


Accepted Solution

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

Author Closing Comment

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

thx anyway

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

860 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