douzi4724
2013-03-25 15:47
浏览 65
已采纳

附加到Apache环境路径

I have a web accessible PHP script that is using a shell command to drop PDFs to text. I installed Poppler, and am using pdftotext, via MacPorts. I am able to run the command successfully from the CL, and when supplying the full path within the PHP script to '/opt/local/bin/pdftotext'. So, I know that my $PATH is correct and the permissions are sufficient, yet I am still getting an exit status of 127: Command Not Found, when attempting to do simply 'pdftotext' in the exec().

I have tried the answers from How do I add paths to the Apache PATH variable? and http://lists.apple.com/archives/macos-x-server/2008/Sep/msg00433.html. I modified both the /etc/paths and /etc/profile, and added /etc/paths.d/macports all pointing to '/opt/local/bin'. setenv, apache_setenv, etc all had no effect also.

I am using a MAMP (1.9 I think) install for my local development, OSX 10.6, PHP 5.3.5, all a little behind I know :-) ... my $PATH is modified to point to the MAMP bin/php

图片转代码服务由CSDN问答提供 功能建议

我有一个可通过Web访问的PHP脚本,它使用shell命令将PDF格式化为文本。 我安装了Poppler,并使用pdftotext,通过MacPorts。 我能够从CL成功运行命令,并在PHP脚本中提供完整路径到'/ opt / local / bin / pdftotext'。 所以,我知道我的$ PATH是正确的,并且权限已经足够了,但是当我尝试在exec()中执行简单的'pdftotext'时,我仍然得到退出状态127:Command Not Found。 \ n

我已经尝试过的答案 如何添加Apache PATH变量的路径? http://lists.apple.com/archives/macos-x-server/2008/Sep/msg00433.html 。 我修改了/ etc / paths和/ etc / profile,并添加了所有指向'/ opt / local / bin'的/etc/paths.d/macports。 setenv,apache_setenv等都没有效果。

我正在使用MAMP(我认为是1.9)安装我的本地开发,OSX 10.6,PHP 5.3.5,都有点落后 我知道:-) ...我的$ PATH被修改为指向MAMP bin / php

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqzve68846 2013-03-26 07:16
    已采纳

    /etc/paths.d/macports will influence on PATH variable for macports, not for the Apache. You probably need to add /etc/parhs.d/apache (or else) to do what you need.
    Edit: also check this and this threads for solutions. It is somewhat outdated but still can help.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题