升级到mac os x Mavericks 10.9后执行php文件时出错

时间:2013-10-28 18:23:55

标签: php macos phpunit osx-mavericks zend-server

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

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

示例:

PHPUnit的:

/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:没有这样的文件或目录

2 个答案:

答案 0 :(得分:0)

您的命令行PHP已经移动了。

尝试which phpunit并以vi或类似方式打开文件。在第一行,它说它预计php会在哪里。要么将这两个文件中的第一行(phpunit和phpcs)更改为

#!/usr/local/zend/bin php

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

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

答案 1 :(得分:0)

我找到了一种解决方法,将顶行#!/usr/local/zend/bin/php替换为以下内容:

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