I have Ghostscript and IMagemagick installed on my local machine. I can access the IM functions from the command line. The environment variables are also set.

The problem is that when I try to execute the IM function using PHP's exec() method, I get no result. The same script works on my remote web host.
When the execution is successful, exec() returns a 0. On my local machine, it returns 4.

Is there a way to see any kind of error message returned from exec()? How do I know that PHP is able to find IM?

Any help in this matter would be useful!

Recommended Answers

All 5 Replies

I have Ghostscript and IMagemagick installed on my local machine. I can access the IM functions from the command line. The environment variables are also set.

The problem is that when I try to execute the IM function using PHP's exec() method, I get no result. The same script works on my remote web host.
When the execution is successful, exec() returns a 0. On my local machine, it returns 4.

Is there a way to see any kind of error message returned from exec()? How do I know that PHP is able to find IM?

Any help in this matter would be useful!

PHP has built-in ImageMagick functions, why are you using an external program?

What are those functions? As far as I know, IM' tools have to be called through the command line. And that is what exec() does.

Thanks. Looking into it.

No idea about debugging exec()?

exec only returns the response code, use shell_exec, that'll get all of the output so if imagemagick is producing errors you'll be able to see them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.