Skip to content

Fork kills connection? #195

Closed
Closed
@polonskiy

Description

@polonskiy

Code:

<?php

$memcached = new Memcached;
$memcached->addServer('localhost', 11211);
$memcached->set('foo', 'bar');

var_dump($memcached->get('foo'), $memcached->getResultMessage());

if (!pcntl_fork()) {
    //child process
    die;
}
pcntl_wait($_);

var_dump($memcached->get('foo'), $memcached->getResultMessage());

Output:

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

ii  libmemcached10:amd64            1.0.8-1ubuntu2                   amd64        C and C++ client library to the memcached server
ii  memcached                       1.4.14-0ubuntu9                  amd64        A high-performance memory object caching system
ii  php5-memcached                  2.1.0-6build1                    amd64        memcached extension module for PHP5, uses libmemcached

string(3) "bar"
string(7) "SUCCESS"
bool(false)
string(9) "NOT FOUND"
PHP 5.6.4-4ubuntu6.4 (cli) (built: Oct 28 2015 01:21:29) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

ii  libmemcached11:amd64       1.0.18-4                     amd64        C and C++ client library to the memcached server
ii  memcached                  1.4.14-0ubuntu9              amd64        A high-performance memory object caching system
ii  php5-memcached             2.2.0-2build1                amd64        memcached extension module for PHP5, uses libmemcached

string(3) "bar"
string(7) "SUCCESS"
bool(false)
string(7) "FAILURE"
PHP 5.6.11-1ubuntu3.1 (cli) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

ii  libmemcached11:amd64             1.0.18-4                     amd64        C and C++ client library to the memcached server
ii  memcached                        1.4.24-2ubuntu1              amd64        high-performance memory object caching system
ii  php5-memcached                   2.2.0-2build1                amd64        memcached extension module for PHP5, uses libmemcached

string(3) "bar"
string(7) "SUCCESS"
bool(false)
string(7) "FAILURE"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions