通过 PHP exec() 将 Linux 服务器设置安全到 运行 脚本?

Secure Linux Server Setup To Run Scripts via PHP exec()?

我想通过 php exec()shell_exec() 运行 脚本 (phantomJS)。在我的开发系统上一切正常。

我已经在我的生产服务器上安装了 phantomJS,并在通过 SSH 登录后从终端成功 运行 它。

但是当我通过 exec()shell_exec() 从 PHP 运行 它时,我收到消息说:

GLIBCXX_3.xx not found

GLIBC_2.xx not found

Web 托管提供商的支持团队表示他们不知道如何使服务器能够访问脚本并仍然保持安全性:

We're not familiar with the specifics of it, so we'll either have to go through with disabling the chroot, but as our supervisor mentioned this will allow all accounts on the server to account with each other which is what the chroot prevents.

You can have your own system administrators look at the setup as you do have root access, and see if they can devise a workaround, but on our end this is the only thing we can suggest.

它们是运行ning CentOS,也就是64位LinuxOS.

到目前为止,我对这个虚拟主机有很好的体验,所以我希望有一种方法可以在不更换主机的情况下解决这个问题。

我拥有该帐户的完全根访问权限,因此我可以以任何必要的方式对其进行配置。

任何人都可以就如何配置我的生产服务器以在维护安全服务器的同时访问 phantomJS 提出一些建议吗?

更新

显然我的应用程序处于“chrooted 环境”中,没有对服务器上的 GLIB 的完全根访问权限。虚拟主机说如果我的 php 用户被授予完全根访问权限,将会缺乏安全性。

您必须删除 PhantomJS 系统调用并创建一个 API 层或订阅 MQ 队列的服务,然后将其与 PHP 集成以避免几个问题,包括 chroot 限制。