douyan8070 2012-05-30 21:59
浏览 125
已采纳

IIS上的PHP - Exec返回1

I have ImageMagick, IIS 6, Ghostscript, and PHP 5.3.1 installed on a Windows Server 2008 box and am trying to convert a PDF file into a JPG thumbnail.

However, it doesn't seem to be working-- the call to exec() produces a return code of 1 (which to my understanding, means that some general error has occurred). The output variable is simply an empty array. $output is simply an empty array. The same occurs if I use system() instead of exec()

Running the command from the command line seems to work, so my initial guess would be a simple permission issue... The directory is writable by PHP because the script that uploads a PDF to the directory works, and I have verified that everyone has permission to write to the directory as well.

Also, safe mode is off.

Any ideas as to what the issue could be?

Relevant code:

<?php
    $output = array();
    $ret = 0;
    echo exec('convert D:\content\myfile.pdf[0] D:\content\myfile_thumb_1.jpg', $output, $ret);
    var_dump($ret);
?>

Note: While I would test this on Apache on Mac OS X, I can't seem to get ImageMagick or Ghostscript installed correctly.

I've also ensured the following:

  • Correct case for the file names (all lowercase anyways)
  • Using the full path of convert.exe in addition to simply convert.exe

UPDATE:

After checking the task manager, convert.exe is being run and is taking up CPU time, suggesting to me that it is file permissions of some sort... I'm going to check it out now.

  • 写回答

1条回答 默认 最新

  • doutandusegang2961 2012-06-06 23:17
    关注

    It turns out there was a permission issue with something in IIS-- the website ran under a different user than the command from CMD, which obviously results in it not working under IIS because it has lesser permissions than from CMD.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 易语言把MYSQL数据库中的数据添加至组合框
  • ¥20 求数据集和代码#有偿答复
  • ¥15 关于下拉菜单选项关联的问题
  • ¥20 java-OJ-健康体检
  • ¥15 rs485的上拉下拉,不会对a-b<-200mv有影响吗,就是接受时,对判断逻辑0有影响吗
  • ¥15 使用phpstudy在云服务器上搭建个人网站
  • ¥15 应该如何判断含间隙的曲柄摇杆机构,轴与轴承是否发生了碰撞?
  • ¥15 vue3+express部署到nginx
  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况