且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Mac中使用shell_exec xampp php

更新时间:2022-11-03 20:13:07

OK,解决所有终端应用程序都不在mac上运行并且在诸如shell_exec之类的任何调用终端应用程序中返回null的问题,执行程序,系统等.这是我花了24小时才知道的一种...这是关于工作目录的.

OK for all of you to solve this kind of problem that any terminal application don't run on mac and returns null in any kind of calling terminal apps like shell_exec, exec, system etc. this is the one of a kind that took me 24 hours to know.. it's about the working dir.

// The Code that took me 24 Hours to Discover.
exec('unset DYLD_LIBRARY_PATH ;');
putenv('DYLD_LIBRARY_PATH');
putenv('DYLD_LIBRARY_PATH=/usr/bin');
$voila = shell_exec("anything you want to execute!");
var_dump($voila);

通过这种方法可以解决您的问题.

with that work around your problem will be fixed.