include() or exec()

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

include() or exec()

Post by JakeJ »

I just had a thought about the way I'm doing something in my application.

I have an application which generates a PDF using tcpdf. I also use a graphing program to out put an image to a file and then I include that file in the pdf. What I'm ALSO doing that may not be the best way is, I am using an include to run the script that creates the image. Since I'm not actually including anything from the file that contains the graphcode, I only need to execute the code, let it output the graphic and include the graphic.

Should I be using exec() instead and are there any benefits or downsides to doing so? I've only ever used includes and it just never occurred to me to do it another way.

Thanks.
Bruno De Barros
Forum Commoner
Posts: 82
Joined: Mon May 12, 2008 8:41 am
Location: Ireland

Re: include() or exec()

Post by Bruno De Barros »

The code that outputs the graphic, is it PHP? Because if it is, then I don't see why you'd have to use exec(), as exec() is for executing external programs.
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: include() or exec()

Post by JakeJ »

The code that creates the graphic is php but there is some compatibility issues between the graphics program and PDF creation program that it's going in to so I have to output the image to a file first.
Post Reply