mysqli opens multiple new processes with p: connect option

前端 未结 1 1491
鱼传尺愫
鱼传尺愫 2021-01-25 02:13

This is my first time asking a question on here. I\'ve scoured Google, stackoverflow, etc. looking for help with the issue I\'m having. We\'re currently using PHP 5.3.10 &

相关标签:
1条回答
  • 2021-01-25 02:55

    I have no experience with mysqli persistent connections but some of your questions and expectations looks strange to me.

    mysqli opens multiple new processes with p: connect option

    Yes, that's what permanent connections are for

    making sure I explicitly close the connection to the database when I'm done with it

    You cannot make sure you closed it explicitly as you just can't do that. Again because the only point of permanent connection is to lasts open

    I would get 3-4 new database connections each time I ran my program.

    So, you have to make sure you're opening only one.

    • You have at least two connects from your script - one old style and some from mysqli?
    • How many mysqli objects being instantiated?
    • How many php scripts being run to serve one HTTP request? Are you sure?

    After all, if it bothers you so much, why you're using persistent connections? Are you any real (not imaginary) benefits from it? After all, if your version is 5.3, why bother with rewriting from mysql at all?

    0 讨论(0)
提交回复
热议问题