升级到10.9 Mavericks后,我在尝试运行php脚本时遇到以下错误 .
我正在使用Zend Server并禁用了默认的httpd和php . 在升级之前一切正常 .
Examples:
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>'
If I run /usr/local/zend/bin/php /usr/local/bin/phpunit or /usr/local/zend/bin/php /usr/local/bin/phpcs it works
Other details:
$ 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 回答
看来您的命令行PHP已移动 .
尝试
which phpunit
并以vi或类似方式打开文件 . 在第一行,它说它预计php会在哪里 . 要么将这两个文件(phpunit和phpcs)中的第一行更改为或者在引用的位置创建一个符号链接到/ usr / local / zend / bin / php
如果您需要这两个步骤中的任何一个,请告诉我们 .
我找到了一个解决方法,将顶行
#!/usr/local/zend/bin/php
替换为以下内容:#!/usr/bin/env /usr/local/zend/bin/php