PHP set the session storage path to Redis, PHP's fpm crashes

Source: Internet
Author: User

  Redis) {$cfg = [' scheme ' = + env (' Redis_scheme ', ' TCP '), ' host ' = env (' RE            Dis_host ', ' 127.0.0.1 '), ' port ' = env (' Redis_port ', 6379)];        $this->redis = new \predis\client ($CFG); }}/** * Close the session * @since 5.4.0 */Public Function Close () {$this->redis-&gt        ; Quit ();    return true; }/** * Destroy a session * @since 5.4.0 */Public Function Destroy ($session _id) {$this->c        Onnect ();    return $this->redis->del ($session _id);     }/** * Cleanup old sessions * @since 5.4.0 */Public Function GC ($MAXLIFETIME) {return true;        }/** * Initialize session * @since 5.4.0 */Public Function open ($save _path, $session _id) {    return true; }/** * Read session data * @since 5.4.0 */Public Function Read ($session _id) {$this->conNect ();    return $this->redis->get ($session _id);        }/** * Write session data * @since 5.4.0 */Public Function Write ($session _id, $session _data) {        $this->connect ();        $expire = Configure (' Ymf.Account.expire '); if (Is_int ($expire) && $expire > 0) {$result = $this->redis->setex ($session _id, $expire, $sess            Ion_data); $re = $result?        ' True ': ' false ';            }else{$result = $this->redis->set ($session _id, $session _data); $re = $result?        ' True ': ' false ';    } return $re; }}

This is my code, how to debug what went wrong

Reply content:


  Redis) {$cfg = [' scheme ' = + env (' Redis_scheme ', ' TCP '), ' host ' = env (' RE            Dis_host ', ' 127.0.0.1 '), ' port ' = env (' Redis_port ', 6379)];        $this->redis = new \predis\client ($CFG); }}/** * Close the session * @since 5.4.0 */Public Function Close () {$this->redis-&gt        ; Quit ();    return true; }/** * Destroy a session * @since 5.4.0 */Public Function Destroy ($session _id) {$this->c        Onnect ();    return $this->redis->del ($session _id);     }/** * Cleanup old sessions * @since 5.4.0 */Public Function GC ($MAXLIFETIME) {return true;        }/** * Initialize session * @since 5.4.0 */Public Function open ($save _path, $session _id) {    return true; }/** * Read session data * @since 5.4.0 */Public Function Read ($session _id) {$this->conNect ();    return $this->redis->get ($session _id);        }/** * Write session data * @since 5.4.0 */Public Function Write ($session _id, $session _data) {        $this->connect ();        $expire = Configure (' Ymf.Account.expire '); if (Is_int ($expire) && $expire > 0) {$result = $this->redis->setex ($session _id, $expire, $sess            Ion_data); $re = $result?        ' True ': ' false ';            }else{$result = $this->redis->set ($session _id, $session _data); $re = $result?        ' True ': ' false ';    } return $re; }}

This is my code, how to debug what went wrong

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.