SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question catching memcache connection errors

    Hi all,

    Well our memcache server went down today and my php is showing lovely errors all over the place.

    Code:
    A PHP Error was encountered
    
    Severity: Warning
    
    Message: Memcache::pconnect() [function.Memcache-pconnect]: Can't connect to localhost:11211, Connection refused (111)
    
    Filename: libraries/memcacheHandler.php
    
    Line Number: 8
    And it seems who ever wrote this meant for that error to appear regardless of whether you call pconnect in an try/catch block or even turn off errors.

    I've created my own class to handle memcache, and here is the constructor. Could anyone see why the try catch isn't working

    Code PHP:
            public function __construct($host = 'localhost', $port = 11211) {
                $this->base = new MemCache;
                try {
                    $this->base->pconnect($host, $port);
                } catch(Exception $e){}
            }

    Thank you all in advance?!

    Gav


  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    append @ infront of it perhaps?
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •