相关疑难解决方法(0)

PHP shell_exec,执行-rwxrwxrwx shell脚本的权限被拒绝

我目前在一个运行Apache网络服务器的远程CentOS 5.6系统上运行ssh.我需要使用poppler pdftohtml二进制文件,遗憾的是,该二进制文件当前未安装在该计算机上.所以我下载了poppler包并在我的用户文件夹下构建它.由于我不是系统管理员,我没有做

make install
Run Code Online (Sandbox Code Playgroud)

我的所有编译文件都在

/users/myfolder/poppler-0.18.2/
Run Code Online (Sandbox Code Playgroud)

我需要通过php执行的文件shell_exec()

/users/myfolder/poppler-0.18.2/utils/pdftohtml
Run Code Online (Sandbox Code Playgroud)

如果我通过ssh bash执行它,我会得到正确的输出.相反,如果我把这一行放在php脚本上:

echo shell_exec("/users/myfolder/poppler-0.18.2/utils/pdftohtml");
Run Code Online (Sandbox Code Playgroud)

我得到以下输出:

sh: /users/myfolder/poppler-0.18.2/utils/pdftohtml: Permission denied
Run Code Online (Sandbox Code Playgroud)

我尝试设置为777文件权限,目前是-rwxrwxrwx.我也注意到使用shell_exec("whoami");"apache"结果.如果文件权限是-rwxrwxrwx,apache是​​否应该能够执行脚本?

我也知道安装poppler make install会解决问题,但由于这是出于测试目的,我想避免在我的个人文件夹外"污染"系统,直到测试完成.

感谢任何有帮助的人!

php permissions poppler shell-exec pdf-to-html

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

pdf-to-html ×1

permissions ×1

php ×1

poppler ×1

shell-exec ×1