Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $asyncTest = new asyncTest();
- $asyncTest->treatElement();
- class asyncTest
- {
- private $db;
- public function __construct()
- {
- echo "New asyncTest (" . getmypid() . ")\n";
- $this->db = mysqli_init();
- $this->db->real_connect('127.0.0.1', 'user', 'pass', 'db');
- }
- public function __destruct()
- {
- $this->disconnect();
- }
- public function disconnect()
- {
- if(isset($this->db))
- {
- $threadId = $this->db->thread_id;
- if($threadId)
- {
- $this->db->kill($threadId);
- }
- $this->db->close();
- unset($this->db);
- }
- }
- public function treatElement()
- {
- sleep(1);
- //$this->disconnect();
- exec("php -d display_errors=on -f conn.php >> conn.log 2>&1 < /dev/null &");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement