Take the 2-minute tour ×

I am working on a ZF application that needs to run a command line script and then parse the results into something meaningful and return to the user.

I know there are various PHP functions, like exec and system, but I was wondering if there is anything built into Zend Framework that does command line scripting easily.

Even if there isn't a ZF specific function, what is the best function/method to use for running a command line script and then retrieving the results in PHP upon completion of the script.

share|improve this question
exec would do fine. No additional overhead needed here. –  takeshin Aug 6 '10 at 6:41
add comment

3 Answers

up vote 1 down vote accepted

I would write a Service which uses exec to get what you need. You can add some basic error handling there.

share|improve this answer
add comment

We recently needed to do this (we use ZF too), hope this helps: http://www.kintek.com.au/web-design-blog/how-to-run-a-php-script-from-command-line/

share|improve this answer
add comment

You can start an process under linux with this:


But never tryed it..

share|improve this answer
When I looked at that, it appeared to be for when you are running via CLI to start with, but I am running the application normally via HTTP. Also note, I need the output back - which I don't think that does either. –  Valorin Aug 6 '10 at 5:33
add comment

Your Answer


