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

Posted on 2016-09-20
Medium Priority
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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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??
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 1000 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 1000 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

770 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