在 php 中运行 xcodebuild
我试图从 php 中运行 xcodebuild 命令,但它似乎没有被调用。我没有从 exec 命令得到任何输出,也没有抛出任何错误。其他命令运行良好,例如 xcrun(我正在使用它来准备应用程序以进行临时分发)。这是我正在调用的代码;
exec('/usr/bin/xcodebuild -version', $output);
print_r($output);
预先感谢您的任何帮助!
编辑:我应该添加,该命令从命令行运行良好,以与 php 脚本相同的用户身份运行。
I'm trying to run the xcodebuild command from within php, and it just doesn't seem to even get called. I get no output from the exec command, and no errors are thrown. Other commands are working just fine, such as xcrun (which I'm using to prepare the app for ad-hoc distribution). Here is the code I'm calling;
exec('/usr/bin/xcodebuild -version', $output);
print_r($output);
Thanks in advance for any help!
Edit: I should add, this command runs fine from the command line, running as the same user as the php script.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的代码对我来说完美运行。
也许您可以将其更改为这样,并确保命令的返回值为 0:
如果
$rv
不是 0,那么至少您知道您的exec()
调用正在运行,只是xcodebuild
命令行由于某种原因失败。Your code runs perfectly for me.
Perhaps you can change it to this and make sure the return value from the command is 0:
If
$rv
is something other than 0, then at least you know yourexec()
call is working and it's just that thexcodebuild
command-line is failing for some reason.我也有这个问题...您是否尝试向用户 nobody 授予完全权限?
I have also this problem... did you tried to give full permissions to user nobody ?
经过 1 天的调试并尝试一切之后,我终于可以使用 php 为我的 ios 应用程序构建一个构建服务器。我在这里列出了我所做的所有事情,以便其他有相同问题的人也可以解决他们的问题。
使用 shell_exec() 而不是 exec(),这样您就可以看到所有输出。
我有这样的东西要测试##
当我第一次运行上面的代码时,我在浏览器上有这个问题
所以我运行
以同意系统范围内的许可证
再次运行代码,我遇到了这个问题
要解决此问题:尝试检查此问题的答案:使用 xcodebuild 构建等待/"runContextManager.runContexts"
修复问题后,我的构建脚本现在可以正常运行。
希望我能帮助您解决您的问题。
After 1 day debug and try everything, i can finally build a build server for my ios app using php. I list all the things i have done here so that others can also fix their problems if they have the same ones.
Use shell_exec() instead of exec(), so that you can see all the output.
I have something like this to test ##
When i first run the above codes, i have this probem on browser
So i run
to agree the license system wide
Run the code again, i have this problem
To solve this: try the checked answer of this question: Building with xcodebuild Timed out waiting for <IDEWorkspace, 0x2004cebc0>/"runContextManager.runContexts"
After fixing the issue, my build script now run normally.
Hope i can help you solving your issues.