Search Results

Search found 1 results on 1 pages for 'user1513171'.

Page 1/1 | 1 

  • PHP Multiple Calls to Server Share Objects?

    - by user1513171
    I’m wondering this about PHP on Apache. Do multiple calls to the server from different users—could be sitting next to each other, in different states, different countries, etc…—share memory? For example, if I create a static variable in a PHP script and set it to 1 by default, then user1 comes in and it changes to 2, and then almost at the exactly same time, user2 comes in, does he see that static variable with a value of 1 or 2? An even better example is this class I have in PHP: class ApplicationRegistry { private static $instance; private static $PDO; private function __construct() { self::$PDO = $db = new \PDO('mysql:unix_socket=/........'); self::$PDO->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); } static function instance() { if(!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; } static function getDSN() { if(!isset(self::$PDO)) { self::instance(); return self::$PDO; } return self::$PDO; } } So this is a Singleton that has a static PDO instance. If user1 and user2 are hitting the server at the exact same time are they using different instances of PDO or are they using the same one? This is a confusing concept for me and I'm trying to think of how my application will scale.

    Read the article

1