【问题标题】:phpfox without works without memcache support?没有memcache支持的phpfox没有工作?
【发布时间】:2013-04-24 11:58:10
【问题描述】:

有没有办法在没有 memcache 服务的情况下使用 Phpfox?因为我使用的是hostgator共享服务器,而共享服务器不提供任何memcache服务,它只能在专用服务器中使用。

我正在使用 Phpfox1.5 以前托管在亚马逊服务器上,那里有 mecache 服务,但它对我来说非常昂贵,所以我想将我的网站从亚马逊更改为 hostgator 托管服务。

致命错误:在第 64 行的 /home/latisse/public_html/spicypeeps.com/include/library/phpfox/cache/storage/memcache.class.php 中找不到类“Memcache”

【问题讨论】:

    标签: php phpfox


    【解决方案1】:

    当然,只需包含一个顶部带有 this class 的文件:

    <?php
    // Dummy Memcache for a development environment where Memcache is not installed. Part of mmvc library, https://github.com/kajala/mmvc
    // Dependencies: none
    
    //if ( defined('MEMCACHE_COMPRESSED') )
    //  die( "Memcache seems to be already installed, MemcacheDummy.php should never be included in this case\n" );
    
    define( 'MEMCACHE_COMPRESSED', 1234 ); // dummy value
    
    /**
     * Dummy Memcache class for a development environment where Memcache is not installed.
     * Note that this class does not do ANYTHING and it is only a convenience for 
     * the development environment and should never be used in production server.
     */
    class Memcache
    {
        function __construct()
        {
        }
    
        function connect( $host, $port )
        {
            assert( is_string($host) );
            assert( is_numeric($port) );
            return true;
        }
    
        function set( $key, $obj, $compressed=false, $expires=0 )
        {
            assert( is_string($key) );
            assert( $compressed === false || $compressed == MEMCACHE_COMPRESSED );
            assert( is_numeric($expires) );
            return true;
        }
    
        function get( $key )
        {
            assert( is_string($key) || is_array($key) );
            return false;
        }
    }
    
    ?>
    

    注意:代码不是我的,它是在 BSD 许可下获得许可的。原作者:link

    【讨论】:

    • 生产环境我需要这个帮助
    • 它可以在生产环境中工作,尽管您可能应该只安装 Memcache。
    • 我没有机会安装 memcache 它的共享主机 hostgator 帐户,他告诉他们不为共享主机提供 memcache 服务?
    • 那你就可以使用我提供的类了。
    猜你喜欢
    • 1970-01-01
    • 2019-09-21
    • 2014-05-22
    • 2012-05-20
    • 2016-10-26
    • 2012-05-22
    • 1970-01-01
    • 2020-05-05
    • 2021-07-21
    相关资源
    最近更新 更多