简体   繁体   English

当我通过浏览器OS X时php exec不运行php脚本

[英]php exec don't run php script when i hit through browser OS X

If i run following script through Mac OS terminal it php command run successfully 如果我通过Mac OS终端运行以下脚本,则php命令成功运行

function run_backend_script($params = array())
{

  $cmd = '/usr/bin/php -v ';
  var_dump(shell_exec($cmd));
}

run_backend_script();

but when i hit through browser script there is no any output; 但是当我浏览浏览器脚本时,没有任何输出; command don't execute. 命令不执行。

Note:- I had installed XAMPP on MacOSX 注意:-我已经在MacOSX上安装了XAMPP

Might be related to the php.ini file in the XAMPP installation. 可能与XAMPP安装中的php.ini文件有关。 Check if you are allowed to execute commands on it. 检查是否允许在其上执行命令。

Try another command, like ls . 尝试另一个命令,例如ls If it works, check the user permission on the /usr/bin/php binary. 如果可行,请检查/usr/bin/php二进制文件上的用户权限。 The apache or www user must be able to execute it. apachewww用户必须能够执行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有exec功能的PHP脚本无法在浏览器中使用,但是如果我使用“ php5 script_name.php”将其运行到终端中,它将可以使用 - Php script with exec function doesn't work into browser but it works if I run it into a terminal with “php5 script_name.php” PHP exec不运行程序 - PHP exec don't run program 通过浏览器执行PHP脚本时,是否不想以apache用户身份执行shell命令? - Don't want php script to execute the shell command as apache user when it is executed through browser? exec()仅在我在浏览器中访问目标php时运行 - exec() just run when i access target php in browser 通过CLI运行PHP脚本,并且在断开SSH时不要停止它 - Run PHP-Script through CLI and don't stop it when disconnecting SSH PHP脚本的一部分不能在EXEC中运行? - Part of PHP script doesn't run in EXEC? Composer.phar 不想由 PHP 脚本中的 shell_exec 运行。 为什么? - Composer.phar don't want to run by shell_exec from PHP script. Why? PHP如何在重定向到自己的变量时维护变量,这样当我通过时,回击时不会收到消息 - PHP how do I maintain my variables on a redirect to myself so that when I pass through I don't get a message when I hit back PHP脚本不会在浏览器中刷新 - php script don't refreshes in browser 为什么我不能使用exec,shell_exec,system从PHP运行作曲家脚本? - Why can't I run the composer script from PHP using exec, shell_exec, system?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM