php - 如何在 OSX apache 上的 PHP 代码和终端中获得 "security"命令的相同结果?

标签 php ios xcode xcodebuild

我在 OSX 的终端中得到了下面的结果

macpro-terminal$ whoami
testuser

macpro-terminal$ groups
staff com.apple.access_screensharing everyone _appstore localaccounts _appserverusr admin _appserveradm _lpadmin _lpoperator _developer com.apple.sharepoint.group.1

macpro-terminal$ security list-keychains
"/Users/testuser/Library/Keychains/login.keychain" "/Library/Keychains/System.keychain"

macpro-terminal$ xcodebuild -project my.xcodeproj .........
......(build result)..........
Build success

但是,我在 OSX apache 上的 PHP 代码中得到了不同的结果

测试.php


    $cpCommand = "whoami";
    $output = shell_exec($cpCommand);
    echo $output;

    $cpCommand = "groups";
    $output = shell_exec($cpCommand);
    echo $output;

    $cpCommand = "security list-keychains";
    $output = shell_exec($cpCommand);
    echo $output;

    $cpCommand = "xcodebuild -project my.xcodeproj ...........";
    $output = shell_exec($cpCommand);
    echo $output;

结果

testuser

staff com.apple.access_screensharing everyone _appstore localaccounts _appserverusr admin _appserveradm _lpadmin _lpoperator _developer com.apple.sharepoint.group.1

"/Library/Keychains/System.keychain"
"/Library/Keychains/apsd.keychain"
"/Library/Keychains/System.keychain"
(comment : /Users/testuser/Library/Keychains/login.keychain -> is not exist)

[BEROR]Code Sign error: The identity 'iPhone Distribution: testuser Co.,Ltd' doesn't match any valid, non-expired certificate/private key pair in your keychains

Build failed

我试过 OS X 10.8 (mountain lion),内置 apache2 和 PHP。
有什么问题吗?
如何在 PHP 代码和 OSX apache 终端中获得相同的“安全”命令结果?

谢谢。

最佳答案

我遇到了非常相似的问题,但在我的例子中,它试图在 Bamboo 下进行构建。

我无法告诉您在您的情况下需要做什么,但另一个问题的答案应该为您指明正确的方向。

Running xcodebuild from a forked terminal

关于php - 如何在 OSX apache 上的 PHP 代码和终端中获得 "security"命令的相同结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12155053/

相关文章:

php - 从 MySQL 数据库的一行中读取一列

php - 如何让按钮正确出现在两列中

php - 在 eclipse Oxygen 中更改 PHP 语言库

ios - 将图片保存在位于 iphone 文档目录中的文件夹中

iphone - 显示 UIPickerview 选择的值

iphone - iPhone 中的 ical API

Xcode Bot 集成错误 : Failed to mmap

iphone - int[] 的 NSArray

PHP:在mysql数据库中插入多维数组,仅特定值

ios - 获取触摸位置的uiview