我编写了一个通过pdftex
编译LaTeX代码的脚本。问题是 pdftex
只能在 Linux 上运行。
我使用 shell_exec()
来完成此任务。
我真的没有能力将 Linux 盒子设置为 Web 服务器。我有我的客户端计算机,但它位于我无法控制的防火墙后面。我确实可以控制我的工作服务器,该服务器运行 SBS 2003,并带有运行 apache 和 php 的 Windows 2000 虚拟机。据我所知,您无法在 Windows 中安装 pdftex
,即使可以安装,它也无法与 shell_exec()
一起使用。
有没有办法用 cygwin 解决这个问题?我可以在 cygwin 中安装 pdftex,然后配置 php 以在 cygwin 内运行 shell_exec()
命令。如果这是可能的,有人可以指出我正确的方向吗?
另外,我想知道是否还有其他行动方案。我不介意购买托管,但任何共享托管计划都不会支持该应用程序。它必须是虚拟或专用托管计划;我买不起。
最佳答案
对于任何想要通过 Cygwin 运行 shell_exec()
的人,请查看 PHP 手册中评论的链接:
http://us.php.net/manual/en/function.shell-exec.php#68647
$result = shell_exec("C:\cygwin\bin\bash.exe --login -c '/cygdrive/c/cygwin/bin/convert.exe --version'");
The key is the "--login" option which appends all the required common cygwin binary and library paths to $PATH. Without this option some of the cygwin binaries that links to other libraries ( Like ImageMagick binaries which links to X11 ) will not work and you may see errors like "cygX11-6.dll not found, Could not start convert.exe"
关于php shell_exec() 通过 cygwin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/414369/