Basab Posted October 19, 2006 Share Posted October 19, 2006 Hi all We need to compile a C program from PHP environmentand to execute the object file of the program. We used PHP system commands writing system('ccprogramname.c -o objectfile') andsystem('./objectfile').It works for small program(wechecked) butin our application it was able to compile but failedto run the objectfile.The object file when executedshould give a large(23 MB) binary file.The program isworking properly from the terminal provided we writethe command ' limit stacksize unlimited' beforerunning the program.The same command 'limit stacksizeunlimited' we tested in PHP but we did not get theresult.Is it feasible in PHP or we r wrong somewhere? Can uall please help?? Basab Goswami Quote Link to comment https://forums.phpfreaks.com/topic/24429-running-a-c-program-from-php/ Share on other sites More sharing options...
Daniel0 Posted October 19, 2006 Share Posted October 19, 2006 Running commands through system is the same as running them in the terminal/commandline. You must however note that the commands will be run by the user the webserver (eg Apache) uses and not your user. Quote Link to comment https://forums.phpfreaks.com/topic/24429-running-a-c-program-from-php/#findComment-111173 Share on other sites More sharing options...
btherl Posted October 23, 2006 Share Posted October 23, 2006 You might try[code]system('limit stacksize unlimited; ./objectfile');[/code]The reason being that the limit is probably reset between system() calls, since system() is opening a new shell each time. Quote Link to comment https://forums.phpfreaks.com/topic/24429-running-a-c-program-from-php/#findComment-112996 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.