Object code execution in PHP Ubuntu 14.04

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sagnik
Forum Newbie
Posts: 1
Joined: Thu Jul 03, 2014 9:05 pm

Object code execution in PHP Ubuntu 14.04

Post by sagnik »

Hello,

I am trying to use PHP to execute a C++ object code which has been already compiled. When the run-time of the object code if low, the PHP page loads perfectly. But when the object code takes a long time to execute, the PHP page shows time out error. Now, one way to get around this error is to increase the response time, but the duration can be increased upto only a certain extent and the duration of run of the object code will change depending on the input provided to it. I want to have a webpage that loads completely and then inside that a part where I can wait till the object code execution completes. How can I do that in PHP? I have tried all variations of shell execution in PHP like shell_exec(), exec(), system() etc.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Object code execution in PHP Ubuntu 14.04

Post by requinix »

You can remove the time limit entirely too.

Code: Select all

set_time_limit(0);
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Object code execution in PHP Ubuntu 14.04

Post by Christopher »

You may also want to convert your page to load the output of the C++ program with Ajax. Load the HTML page first and then have Javascript call the program and display the results. If the program can run long depending on the input provided, you may want to have it return partial results and allow the Javascript to call it repeatedly until no more data is available.
(#10850)
Post Reply