首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP Restler Server 500错误

PHP Restler Server 500错误
EN

Stack Overflow用户
提问于 2013-09-05 20:55:34
回答 1查看 1K关注 0票数 0

我用作曲家安装了restler。我已经为它建立了一个虚拟主机。我可以在浏览器中访问我的localhost,它显示了一些信息页面,但是当我尝试其中一个API时,我就得到了一个服务器500 error

我的PHP日志显示:

代码语言:javascript
复制
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。

更新

以下是我所有的日志:

代码语言:javascript
复制
[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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 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中得到解决。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18645806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档