CakePHP Media Plugin Issue - undefined method MIME_Type::config()

蓝咒 提交于 2020-01-07 03:15:26

问题


I am using the Media plugin by David Persson for CakePHP (https://github.com/davidpersson/media). I've placed the files in app/plugins/media and added

require APP . 'plugins/media/config/core.php';

to my app's core.php, but when I run cake media init I get this error:

Fatal Error: Call to undefined method MIME_Type::config() in C:\xampp\htdocs\wompwomp\app\plugins\media\config\core.php on line 166

Any idea what's happening here? Can I just make the directories manually? If so, what are the default directories?


回答1:


It looks like you need to install the MIME_Type library. The pear package for it is available here.

EDIT The proper library would be found here.




回答2:


I encounter this error on windows when i updated my php to 5.3.5 (xampp 1.7.4).

There is a conflict between Cakephp Mime Types and Pear Mime types. I rename the folder or

disable Pear Mime Type located at /php/PEAR/MIME..

That solves the problem.




回答3:


Here is my solution to the conflict between the Plugin library and Pear library:

As we all known, the order of multiple php include_path matters, in other words, if the PEAR path is set before the Cake Media Plugin Built_In Mine_Type Library Path, the Mine_Type class in PEAR is found first, and the built-in one is ignored, that's the reason of the error.

To fix this, just open /app/plugins/media/config/core.php, and find the ini_set('include_path') directive, move the cake media plugin built-in library path to the very beginning of the INCLUDE_PATH.

That's it, enjoy!

Maybe someone can report this as a bug to the plugin author.



来源:https://stackoverflow.com/questions/5684103/cakephp-media-plugin-issue-undefined-method-mime-typeconfig

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!