Php 如何让iOS运行子进程?
我正在为iOS编写一个应用程序,它将启动php二进制文件作为一个子进程 使用以下代码:Php 如何让iOS运行子进程?,php,ios,ipad,Php,Ios,Ipad,我正在为iOS编写一个应用程序,它将启动php二进制文件作为一个子进程 使用以下代码: NSString * command = @"/bin/sh -c '"; command = [command stringByAppendingString:[BibleditPaths php]]; command = [command stringByAppendingString:@" -v' > /tmp/php.txt 2>&1"]; int output = system
NSString * command = @"/bin/sh -c '";
command = [command stringByAppendingString:[BibleditPaths php]];
command = [command stringByAppendingString:@" -v' > /tmp/php.txt 2>&1"];
int output = system ([command UTF8String]);
NSString* msg = [@(output) stringValue];
NSLog(msg, @"");
php二进制文件可以从命令行在越狱的iPad上启动。这是输出:
PHP 5.4.31 (cli) (built: Aug 19 2014 11:06:21)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
当从上面的代码启动php二进制文件时,iOS发送SIGKILL信号。
php二进制文件不会运行或产生任何输出
/bin/sh生成此输出:
sh: line 1: 2806 Killed: 9 /bin/sh -c '/var/mobile/Applications/DFE552CC-ECBE-4A73-82CF-24870E5D9F62/Library/usr/local/bin/php -v' > /tmp/php.txt 2>&1
2014-09-15 17:33:41.676 PHPRunner[2804:60b] 35072
如何让iOS成功运行此过程?此问题已发布在Apple iOS开发论坛上 答复是: iOS上的应用程序沙盒不支持或不允许这些 随后,该问题从论坛上删除 我将答案张贴在这里,以便为公众保留信息