0

升级到 10.9 Mavericks 后,尝试运行 php 脚本时出现以下错误。

我正在使用 Zend Server 并禁用了默认的 httpd 和 php。升级前一切正常。

例子:

php单元:

/usr/local/bin/phpunit: line 2: ?php: No such file or directory
/usr/local/bin/phpunit: line 3: /Applications: is a directory
/usr/local/bin/phpunit: line 4: LICENSE.html: command not found
/usr/local/bin/phpunit: line 5: syntax error near unexpected token `('
/usr/local/bin/phpunit: line 5: ` * Copyright (c) 2001-2013, Sebastian Bergmann <sebastian@phpunit.de>.'

phpcs

/usr/local/zend/bin/phpcs: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpcs: line 3: /Applications: is a directory
/usr/local/zend/bin/phpcs: line 4: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 5: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 6: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 7: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 8: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 9: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 10: LICENSE.html: command not found
/usr/local/zend/bin/phpcs: line 11: syntax error near unexpected token newline
/usr/local/zend/bin/phpcs: line 11: ` * @author    Greg Sherwood <gsherwood@squiz.net>'

如果我运行 /usr/local/zend/bin/php /usr/local/bin/phpunit 或 /usr/local/zend/bin/php /usr/local/bin/phpcs 它可以工作

其他详情:

$PATH -bash:/opt/local/bin:/opt/local/sbin:/usr/local/zend/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin :/opt/X11/bin:/usr/local/zend/bin: 没有这样的文件或目录

4

2 回答 2

0

我通过用以下内容替换顶行找到了一种解决方法#!/usr/local/zend/bin/php

#!/usr/bin/env /usr/local/zend/bin/php

于 2013-11-08T13:26:33.677 回答
0

看来您的命令行 PHP 已移动。

尝试which phpunit在 vi 或类似文件中打开文件。在第一行中,它说明了它期望 php 的位置。您可以将这两个文件(phpunit 和 phpcs)中的第一行更改为

#!/usr/local/zend/bin php

或者您在引用的位置创建一个符号链接到 /usr/local/zend/bin/php

如果您在这两个步骤中的任何一个方面需要帮助,请告诉我。

于 2013-11-05T15:59:30.857 回答