【发布时间】:2015-11-18 16:32:04
【问题描述】:
我想同时使用 shell 和 php。 首先我试过: shell_exec vs 函数被禁用,必须如此。 但是 php 不允许我运行 shell_exec() 所以,我放弃并尝试制作一个.sh,调用php,将php的输出存储为sh文件并运行sh文件。 这是sh代码
#!/bin/bash/
php test.php -> running php file/ test.php saves commands in script.sh
sh script.sh -> running the commands
rm script.sh -> removing the commands
但是从这个文件过程中必须有更好的方法。 我可以直接在 .sh 文件中运行 test.php 的输出吗? 我可以运行 shell_exec 吗?
注意:我有服务器的 root 访问权限。
【问题讨论】:
-
如果你有服务器的root访问权限,当然你可以在php.ini中启用
shell_exec(),对吧? -
这是共享服务器,出于安全原因,我无法启用 shell_exec。