<?
echo $cmd = "cd C:\\PROGRA~1\\ImageMagick-6.7.3-Q16 & convert -colorspace RGB -size 120x120 -resize 120x120 \"D:\htdocs\\tempfile.pdf\" \"D:\\htdocs\\temp\\file.jpg\"";
exec($cmd);
?>
When executing through PHP nothing happens.
If I copy $cmd to DOS it works.
The same script works on other server.
Any ideas?
Can't exec convert through exec() on windows
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can't exec convert through exec() on windows
I am no expert on PHP on windows but it may want forward slashes rather than backslashes.
Some PHP configurations will not allow exec(). Check with your PHP setup or ISP.
Some PHP configurations will not allow exec(). Check with your PHP setup or ISP.
Re: Can't exec convert through exec() on windows
Image paths can use forward slashes, but the convert.exe path must be declared with backslashes.
The application I'm managing was runing without errors, but there was a contingence that Windows had to be reinstalled. I'm restoring all the application funcionalities, but the convert command called by exec function is not working.
I don't understand if there is a permission issue that appeared after reinstalling Windows or what is the problem that is causing the convert command be ignored by the exec function.
Really any help is appreciated!!
The application I'm managing was runing without errors, but there was a contingence that Windows had to be reinstalled. I'm restoring all the application funcionalities, but the convert command called by exec function is not working.
I don't understand if there is a permission issue that appeared after reinstalling Windows or what is the problem that is causing the convert command be ignored by the exec function.
Really any help is appreciated!!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can't exec convert through exec() on windows
Does your PHP have the right path to IM?
Have you checked your php config. http://yourwebaddress/phpinfo.php
Have you checked your php config. http://yourwebaddress/phpinfo.php
Re: Can't exec convert through exec() on windows
Why should my PHP have the right to use IM? Since I'm calling convert from the command line, is there any permission that dhould be set?
Re: Can't exec convert through exec() on windows
Sorry, I misunderstood your comment.
My PHP script has the correct path to convert.
If I copy the command line generated by PHP and copy it to DOS it works fine.
Just through PHP convert is not being executed.
My PHP script has the correct path to convert.
If I copy the command line generated by PHP and copy it to DOS it works fine.
Just through PHP convert is not being executed.
Re: Can't exec convert through exec() on windows
I was checking phpinfo as you suggested.
The Imagemagick path appeared under Apache environment -> Path on previous instalation, but is not appearing now.
I'm not sure from where Apache environment -> path is being read...
The Imagemagick path appeared under Apache environment -> Path on previous instalation, but is not appearing now.
I'm not sure from where Apache environment -> path is being read...