我在 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 下进行构建。
我无法告诉您在您的情况下需要做什么,但另一个问题的答案应该为您指明正确的方向。
关于php - 如何在 OSX apache 上的 PHP 代码和终端中获得 "security"命令的相同结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12155053/