我用作曲家安装了restler。我已经为它建立了一个虚拟主机。我可以在浏览器中访问我的localhost,它显示了一些信息页面,但是当我尝试其中一个API时,我就得到了一个服务器500 error。
我的PHP日志显示:
Function main
Error Type E_ERROR
Source File /public/examples/_001_helloworld/index.php : 18
Error String Class 'Luracast\Restler\Restler' not found我直接从项目中使用示例代码。看起来它有require_once '../../../vendor/restler.php',而且似乎仍然有500个错误。
我在Mac上使用PHP 5.4.16。
更新
以下是我所有的日志:
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_classmap.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_classmap.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(/Users/ChrisLondon/composer/autoload_namespaces.php): failed to open stream: No such file or directory in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: include(): Failed opening '/Users/ChrisLondon/composer/autoload_namespaces.php' for inclusion (include_path='.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/opt/local/lib/php') in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 432
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_values() expects parameter 1 to be array, boolean given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 154
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #2 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_merge(): Argument #1 is not an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 155
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_map(): Argument #2 should be an array in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_filter() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 166
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: natsort() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 167
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: array_unique() expects parameter 1 to be array, null given in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Warning: implode(): Invalid arguments passed in /Users/ChrisLondon/personal/SuperfyMe/vendor/Luracast/Restler/AutoLoader.php on line 170
[05-Sep-2013 17:05:09 America/Denver] PHP Fatal error: Class 'Luracast\Restler\Restler' not found in /Users/ChrisLondon/personal/SuperfyMe/public/examples/_001_helloworld/index.php on line 19它似乎试图在这里找到autoload类:/Users/ChrisLondon/composer/autoload_classmap.php,但文件实际上在这里:/Users/ChrisLondon/personal/SuperfyMe/vendor/composer/autoload_classmap.php
发布于 2013-09-06 02:49:15
解决了我的问题。
这是因为我有一个名为composer/的文件夹,它恰好是两个文件夹,位于Restler应用程序所在的位置,它破坏了Restler自动加载程序。要解决这个问题,需要做以下工作之一:
1)在Restler应用程序所在的位置上没有任何名为composer/的文件夹
2)修改Restler autoloader以跳过文件夹(在本文发布时,您可以注释掉line 138 of /vendor/Luracast/Restler/Autoloader.php)
我在GitHub上提出了一个更优雅的解决方案:
发行:https://github.com/Luracast/Restler/issues/195
请求:https://github.com/Luracast/Restler/pull/196
当其他人找到这篇文章的时候,希望这个问题能在未来版本的Restler中得到解决。
https://stackoverflow.com/questions/18645806
复制相似问题